nl stringlengths 13 387 | bash stringlengths 1 532 |
|---|---|
Move all *.emlx files/directories under /path/to/folders/ to ./Messages/ directory | find /path/to/folders/ -name \*.emlx -print0 | xargs -0 -I {} mv {} ./Messages/ |
Move all *.mp4 files from directory /foo/bar and its subdirectories to /some/path | find /foo/bar -name '*.mp4' -exec mv -t /some/path {} + |
Move all *.mp4 files from directory /foo/bar and its subdirectories to /some/path | find /foo/bar -name '*.mp4' -print0 | xargs -0 mv -t /some/path {} |
Move all *.php~ (case insensitive) files under current directory to /mydir | find . -iname "*.php~" -exec mv "{}" /mydir +; |
Move all *.php~ (case insensitive) files under current directory to /mydir | find . -iname "*.php~" -exec mv {} /mydir \; |
Move all the .c files from the current directory tree to temp/ | find . -name "*.c" -print0 | xargs -0 -n1 -I '{}' mv '{}' temp |
Move all directories from the `sourceDir' directory tree to the `destDir' directory | find sourceDir -mindepth 1 -type d -exec mv -t destDir "{}" \+ |
Move all directories from the `sourceDir' directory tree to the `destDir' directory | find sourceDir -mindepth 1 -type d -print0 | xargs -0 mv --target-directory=destDir |
Move all directories in the current directory that match "some-dir" to "x/" | find ./ -maxdepth 1 -name "some-dir" -type d -print0 | xargs -0r mv -t x/ |
Move all Emacs backup files from the current directory tree to ~/backups/ | find . -name '*~' -print 0 | xargs -0 -I % cp % ~/backups |
Move all files and directories in the current directory to "$TARGET" excluding files matching "$EXCLUDE" | ls -1 | grep -v ^$EXCLUDE | xargs -I{} mv {} $TARGET |
Move all files and directories in the current directory to "/tmp/blah/" | mv * /tmp/blah/ |
Move all files and directories in the current directory to "somewhere/" | mv `ls` somewhere/ |
Move all files and directories matching "*.boo" in the current directory to "subdir" | mv `ls *.boo` subdir |
Move all files and directories not starting with "l" in "/mnt/usbdisk" to "/home/user/stuff/." | mv /mnt/usbdisk/[^l]* /home/user/stuff/. |
Move all files/directories under current directory to ~/play | find . -exec mv '{}' ~/play/ \; |
Move all files/directories under current directory to ~/play | find . | xargs -I'{}' mv '{}' ~/play/ |
Move all files from "src/test/" to "dest" displaying progress | rsync -a --progress --remove-source-files src/test/ dest |
Move all files from the `sourceDir' directory tree to the `destDir' directory | find sourceDir -mindepth 1 -exec mv "{}" --target-directory=destDir \; |
Move all files from the `sourceDir' directory tree to the `destDir' directory | find sourceDir -mindepth 1 -print0 | xargs -0 mv --target-directory=destDir |
Move all files in "/path/subfolder" to "/path" without clobbering any destination files | find /path/subfolder -maxdepth 1 -type f -name '*' -exec mv -n {} /path \; |
move all files in the current folder another folder and do not move the files in the sub folder | find . -name "*" -maxdepth 1 -exec mv -t /home/foo2/bulk2 {} + |
move all the files in the current folder to temp folder and search atleast in one subfolder | find . -mindepth 1 -exec mv -t /tmp {} + |
move all the files in the current folder to temp folder and search atleast in one subfolder | find . -mindepth 1 -print0|xargs -0 -I, mv , /tmp |
Move all files including hidden files and excluding ".." in "/path/subfolder/" to "/path/" | mv /source/path/{.[!.],}* /destination/path |
Move all files including hidden files in "/path/subfolder/" to "/path/" | mv /path/subfolder/{.,}* /path/ |
Move all files listed in $i file to dir.$count directory | cat $i | xargs mv -t dir.$count |
Move all files matching case insensitive ".cpp" in the current directory tree to "./test/" | find . -type f -iname '*.cpp' -exec mv -t ./test/ {} \+ |
Move all files matching patterns "*.old", ".old", ".*.old" from the current directory to directory "../old/" | find . ! -name . -prune -name '*.old' -exec mv {} ../old/ \; |
Move all files not matching "Tux.png" in "~/Linux/Old" to "~/Linux/New/" using zsh with "EXTENDED_GLOB" | mv ~/Linux/Old/^Tux.png ~/Linux/New/ |
Move all files that contain "Subject: \[SPAM\]" to "DIR" | grep -L -Z -r 'Subject: \[SPAM\]' . | xargs -0 -I{} mv {} DIR |
Move all files that contain "Subject: \[SPAM\]" to "DIR" | grep -l 'Subject: \[SPAM\]' | xargs -I '{}' mv '{}' DIR |
Move all hidden files in "/path/subfolder/" to "/path/" | mv /path/subfolder/.* /path/ |
Move all hidden files in "wordpress" to the current directory | mv wordpress/.* . |
move all the html files from current folder to another folder and if a symbolic link is found copy the original referenced file and not the link | find . -follow -iname '*.htm' -print0 | xargs -i -0 mv '{}' ~/webhome |
Move the directory named "some-dir" and residing under the current one to x/ | find ./ -maxdepth 1 -name "some-dir" -type d -print0 | xargs -0r mv -t x/ |
Move each of the 'm?' directories in $path_to_folders to another directory whose name is constituted by appending .mbox to each directory name and create a directory named Messages in this directory then move all *.emlx files into this directory | find "$path_to_folders" -name 'm?' -type d -exec mv {} {}.mbox \; -exec mkdir {}.mbox/Messages \; -exec sh -c "mv {}.mbox/*.emlx {}.mbox/Messages" \; |
Move each of the 'm?' directories in current directory to another directory whose name is constituted by appending .mbox to each directory name and create a directory named Messages in this directory then move all *.emlx files into this directory | find . -name 'm?' -type d -exec mv '{}' '{}.mbox' ';' -exec mkdir '{}.mbox/Messages' ';' -exec sh -c 'mv {}.mbox/*.emlx {}.mbox/Messages' ';' |
Move each of the directories in /path/to/folders/* to another directory whose name is constituted by appending .mbox to each directory name and create a directory named Messages in this directory | find /path/to/folders/* -type d -exec mv {} {}.mbox \; -exec mkdir {}.mbox/Messages \; |
Move files older than 1 day to directory TMP | find . -atime +1 -type f -exec mv {} TMP \; |
Moves the file that named like file $1 from '/tmp' folder to the folder where $2 file is located. | mv "/tmp/`basename $1`" "`dirname $2`" |
Move server.log to 'logs' directory with new name as the current date formatted as "%Y%m%d%H%M" and with '.log' extension | mv server.log logs/$(date -d "today" +"%Y%m%d%H%M").log |
Non-recursively finds all '*.pdf' files in a current folder and removes them. | find -maxdepth 1 -name '*.pdf' -exec rm "{}" \; |
Non-recursively finds all '*.pdf' files in a current folder and removes them. | find . -maxdepth 1 -name "*.pdf" -print0 | xargs -0 rm |
Number each line in "/etc/passwd" as right-justified zero padded to a width of 9 | nl -nrz -w9 /etc/passwd |
Number each line in "foobar" as right-justified zero padded to a width of 9 | nl -nrz -w9 foobar |
Number each non-blank line of standard input | nl |
Number every line of standard input as zero padded to 6 characters followed by "-" | nl -s- -ba -nrz |
Numberically sort content of file 'files', using for sorting part of second one of dash separated fields beginning from second letter. | cat files | sort -t- -k2,2 -n |
Numerically sort each line in file "bb" and output the result to console from greatest value to least value | sort -nr bb |
Numerically sort each line in file "out" and print the result to console | sort -n out |
Numerically sort each line of standard input | sort -n |
Numerically sort file "files" by the second "-" separated value of each line ordered from least value to highest value | tac files | sort -t- -k2,2 -n |
Numerically sort file "table" by the fourth character of the second field, ignoring leading spaces | sort -b -n -k2.4 table |
Numerically sort IPv4 addresses specified on standard input with presedence to first, second, third, then fourth octet | tr '.' ' ' | sort -nu -t ' ' -k 1 -k 2 -k 3 -k 4 | tr ' ' '.' |
Numerically sort standard input by the second word of each line | sort -n -k 2 |
Numerically sort standard input by the second word of each line and output from greatest value to least value | sort -nrk 2,2 |
On host "server_b", connect as ssh user "user" and copy "/my_folder/my_file.xml" to directory "/my_new_folder/". | scp user@server_b:/my_folder/my_file.xml user@server_b:/my_new_folder/ |
On host "server_b", connect as ssh user "user" and copy "/my_folder/my_file.xml" to directory "/my_new_folder/", with all transfer data relayed through local host. | scp -3 user@server_b:/my_folder/my_file.xml user@server_b:/my_new_folder/ |
only get md5sum of a file | md5 -q file |
Open a local SSH port on 1080 for application-level port forwarding | ssh -D1080 root@localhost -g |
Open a session-less connection to 'host' as user 'user' in master mode with a socket "/tmp/%r@%h:%p" to enable connection sharing | ssh user@host -M -S /tmp/%r@%h:%p -N |
Open a ssh connection to "user@host" with a control socket "/tmp/%r@%h:%p" | ssh user@host -S /tmp/%r@%h:%p |
Opens gawk info manual and goes to command-line options node. | info -O gawk |
Opens gcc info manual and goes to a node pointed by index entry "funroll-loops". | info gcc --index-search=funroll-loops |
Opens menu item 'Basic Shell Features' -> 'Shell Expansions' -> 'Filename Expansion' -> 'Pattern Matching' in the 'bash' manual. | info bash 'Basic Shell Features' 'Shell Expansions' 'Filename Expansion' 'Pattern Matching' |
Output "file.txt", omitting all containing directories "some/unknown/amoutn/of/sub/folder/" | basename "some/unknown/amount/of/sub/folder/file.txt" |
Output "stuff", removing "/foo/bar/" from the specified path. | basename /foo/bar/stuff |
Output "testFile.txt.1" without the ".1" suffix. | basename testFile.txt.1 .1 |
Output two lines of "-tcp" | yes -- "-tcp" | head -n 2 |
Output two lines of "-tcp" | yes -- -tcp | head -n 2 |
Output all lines in BigFile.csv whose secondn comma-separated second field matches first field of a line in LittleFile.csv. | join -1 2 -2 1 -t, BigFile.csv LittleFile.csv |
Output all lines that have a common first colon-separated field in files 'selection2.txt' and 'selection1.txt' by displaying the common (first) field of each line, followed by the extra fields in both lines. | join -t: selection2.txt selection1.txt |
Output the base name of first argument to script or function, that is the part following the last slash. | echo $(basename "$1") |
Output the file name "file.txt' from the path "some/unknown/amount/of/sub/folder/file.txt" | basename "some/unknown/amount/of/sub/folder/file.txt" |
Output the last slash-separated component of specified path, in this case "data_report_PD_import_script_ABF1_6" | basename /EBF/DirectiveFiles/data_report_PD_import_script_ABF1_6 |
Output only the filetype suffix of "foo.tar.gz", in this case "gz" | echo "foo.tar.gz" | rev | cut -d"." -f1 | rev |
Output the specified path removing all containing directories and the .txt suffix, in this case "filename". | basename /path/to/dir/filename.txt .txt |
Output the string 'yes' continously until killed | yes |
Output the system host name and date to the console | echo Hostname=$(hostname) LastChecked=$(date) |
Output the variable "filename" without the last dot-separated section. | echo ${filename%.*} |
Overwrite a file 'my-existing-file' with random data to hide its content | shred my-existing-file |
Overwrites file $FILE with random content, then truncates and deletes it. | shred -u $FILE |
Overwirte file '/path/to/your/file' with random content, then overwrite with zeroes, and remove, showing progress while execution. | shred -v -n 1 -z -u /path/to/your/file |
Overwirte file '/path/to/your/file' with random content, showing progress while execution. | shred -v -n 1 /path/to/your/file #overwriting with random data |
Overwirte file '/path/to/your/file' with zeroes and remove, showing progress while execution. | shred -v -n 0 -z -u /path/to/your/file #overwriting with zeroes and remove the file |
Overwrites file 'filename' with random content 35 times, finally writes it with zeros, truncates and deletes. | shred -uzn 35 filename |
Pair side-by-side content of the 'file' and its side-mirrored content | paste -d ' ' file <(rev file) |
Pass a wildcard to scp by escaping it: copy all files with names starting with "files" in directory "/location" on host "server" to current directory on local machine, displaying debug info and preserving timestamps and permissions on copied files. | scp -vp me@server:/location/files\* |
Perform a case insensitive search for *.jpg files which are greater than 500KB in size under /ftp/dir/ directory | find /ftp/dir/ -size +500k -iname "*.jpg" |
Perform a case insensitive search for *filename* files/directories under current directory tree | find . -iname "*filename*" |
Perform a default cPanel configuration | find /home/*/public_html/ -type f -iwholename “*/wp-includes/version.php” -exec grep -H “\$wp_version =” {} \; |
Perform a default Plesk configuration | find /var/www/vhosts/*/httpdocs -type f -iwholename “*/wp-includes/version.php” -exec grep -H “\$wp_version =” {} \; |
Perform a dry run replacing "special" with "regular" in all file names in the current directory | rename -n 's/special/regular/' ** |
Perform a dry run to recursively copy "test/a" to "test/dest" excluding "test/a/b/c/d" | rsync -nvraL test/a test/dest --exclude=a/b/c/d |
Perform case insensitive search for *.gif files/directories under downloads directory | find downloads -iname "*.gif" |
Perform white space safe deletion of files named core under /tmp | find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f |
Ping all hosts in file "ips" twice | cat ips | xargs -i% ping -c 2 % |
Ping all hosts in file "ips" twice | cat ips | xargs -n1 ping -c 2 |
Ping the broadcast address "10.10.0.255" | ping -b 10.10.0.255 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.