Changes

How Do I: A Linux Q&A

5,203 bytes added, 16 February
The following lines were added (+) and removed (-):
== [FORCE EJECT DVD / CDROM DISC] ==-------------------------------------------------------------------------------Determine where it is mounted using the 'df' command then, not against the dev but the mountpoint issue the following: sudo fuser -km /media/label == [RESUME A STOPPED JOB IN LINUX] ==-------------------------------------------------------------------------------If you see [1]+  Stopped at the console you've stopped a process and placed it in the background.  You may have accidentally pressed Ctrl+Z or you intentionally stopped the process job and now you wish to resume it.type: fgYou can add the job number behind the fg command, if there is only one job it will be job 1 and default to that job.  Learn more about [[Job Management in Linux]].== [HOWTO EXTRACT xz / tgz FILE IN LINUX] ==The xz format is a single-file compression format that is based on the LZMA2 algorithm.  Requires xz toos.  Mint/Ubuntu install sudo apt install xz-utilsextract/unzip xz tar file tar -xvf userfiles.tar.xzArchive types tar.gz and tar.xz are both compressed tar-files, however, using variations on the compression method.  For the user there is no difference when extracting either type of file, with the exception of extraction speed.  The compression method for xz produces a more densely compact file resulting in a higher level of compression at the expense of speed.  It may take longer, or even significantly longer to extract files from a xz archive.== [HOWTO COMPRESS with tar zip tar.gz tgz] ==Back up a directory of files and preserve the path.  tar -zcvf sourcefiles archive.tar.gz* -z compress using zip* -c create* -v verbose* -f archive file to createYou can add -p to preserve absolute names, so that the path will begin with the root / and all the way to the directory location.  This is really only useful for doing backups/== [HOWTO EXTRACT xz FILE IN LINUX] ==The xz format is a single-file compression format that is based on the LZMA2 algorithm.  Requires xz toos.  Mint/Ubuntu install sudo apt install xz-utilsextract/unzip xz tar file tar -xvf userfiles.tar.xz== [LIST FILES IN FOLDER BASED ON DATE RANGE OR NEWER / OLDER THAN] ==Some related searches: linux list files modified after date and linux list files for a specific date range.  This is not a task best suited for the 'ls' command.  Instead, we defer to the '[[Find_and_Locate|find]]' command.You can use the find command to find all files that have been modified after a certain number of days. For example, to find all files in the current directory that have been modified since yesterday (24 hours ago) use: find . -maxdepth 1 -mtime -1Note that to find files modified before 24 hours ago, you have to use -mtime +1 instead of -mtime -1. find . -type f -newermt '1/30/2017 0:00:00'This will find all files modified after a specific date.A range: m  The modification time of the file reference t  reference is interpreted directly as a timetry find . -type f -newermt 20111222 \! -newermt 20111225note that you can directly specify your dates: find -type f -newermt "2011-12-22" \! -newermt "2011-12-24"or find -type f -newermt "2011-12-22 00:00:00" \! -newermt "2011-12-24 13:23:00"if you additionally want to specify the time. find . -mindepth 1 -maxdepth 1 -mtime -7  find . -type f -newermt '11/25/2020 0:00:00'If you don't limit the search to files when it finds a matching directory it will list every file within it.  Be sure to use the "-type f" for files. find . -type f -mtime -30Now with some fancy formatting find . -type f -mtime -30 -printf "%M %u %g %TR %TD %p\n"Last, this working example was used to check a public share on a file server and generate a report, showing only files modified after the specific date. find . -type f -newermt '11/25/2020 0:00:00' > ~/public-drive-newer.txt== [MEASURE THE STRENGTH OF WIFI CONNECTION] ==To measure the strength of the wireless connection from CLI watch -n1 iwconfigShows link quality as well as signal level.== [MONITOR USB PORTS FOR CONNECTING OR DISCONNECTING] ==udevadm real-time monitoring of usb ports: To see if a device is plugged into USB or unplugged, real time monitoring showing when a USB device is connected or disconnected. udevadm monitor --subsystem-match=usbDoes not require sudoAs soon as you connect any USB device, be it a USB flash drive or USB keyboard, mouse, etc details will be displayed.  Also when disconnected.== [CLI SHELL AUTO COMPLETE COMMAND LINE PATH NO LONGER CYCLES] ==This is actually a readline feature called menu-complete . You can bind it to tab (replacing the default complete) by running: bind TAB:menu-completeYou probably want to add that to your ~/.bashrc. Alternatively, you could configure it for all readline completions (not just bash) in ~/.inputrc.You may also find bind -p (show current bindings, note that shows tab as "\C-i") and bind -l (list all functions that can be bound) useful, as well as the bash manual's line editing section and readline's documentation.  source: [https://unix.stackexchange.com/questions/24419/terminal-autocomplete-cycle-through-suggestions derobert on stackexchange]
Bureaucrat, administrator
16,199
edits