nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Recursively change the owner and group of "/workspace" and "775" to "your_user_name" | chown -R your_user_name.your_user_name 775 /workspace |
Search the /etc directory tree for files accessed within the last 24 hours | find /etc -atime -1 |
Copy "source" recursively to "destination" excluding "path1/to/exclude" and "path2/to/exclude" | rsync -av --exclude='path1/to/exclude' --exclude='path2/to/exclude' source destination |
Append the last modification time of file $arg as the seconds since epoch with a preceding space to the variable 'KEY' | KEY+=`date -r "$arg" +\ %s` |
Print the number of lines in file.txt. | wc -l file.txt | cut -f1 -d" " |
display all the files in the file system which belong to no group | find / -nogroup staff -print |
Displays calendar for a previous, current and next month. | cal -3 |
Use awk command '{ ... }' on compressed files "input1.vcf.gz" and "input2.vcf.gz" | awk '{ ... }' < < |
Find all regular files starting from level 3 of directory tree ~/container and move them one level up | find ~/container -mindepth 3 -type f -execdir mv "{}" ./.. \; |
Print first column of every line in every *.txt separated by a space | paste -d':' *.txt | sed 's/ [^:]*$//;s/ [^:]*:*/ /g;s/://g' |
Find directories named `doc' in /usr and below | find /usr \ |
Delete files "*doc copoy" in directory tree /mnt/zip | find /mnt/zip -name "*doc copy" -execdir rm "{}" \; |
Recursively finds and compresses all files in a current folder. | find . -type f -exec bzip2 {} + |
Find all regular files in the current directory tree last modified between 1 and 3 days ago and list them using format '%Tm %p\n' | find ./ -daystart -mtime -3 -type f ! -mtime -1 -printf '%Tm %p\n' |
find all the directories with the name "c" in the current folder which are at least 3 levels deep and which are not present in the path "/p/". | find -mindepth 3 -type d ! -path '*/p/*' -name c -print |
Read standard input until a null character is found and save the result in variable "f2" | read -r -d $'\0' f2 |
Verbosely compresses all files on fourth and fifth depth level keeping original files in place. | bzip2 -kv */*/*/*/* |
find all the text files in the current folder and display the results pagewise | find . -name "*.txt" -print | less |
find all the files in the folder /home which are bigger than 10MB and smaller than 50 MB | find /home -size +10M -size -50M |
Numerically sort file "file.dat" by the second word of each line and output from greatest value to least value | sort -nrk 2,2 file.dat |
search for "some_function" in all the python files in the current directory | find . -name \*.py | xargs grep some_function |
Print IP addresses of the host name | hostname --all-ip-address|cut -d ' ' -f1 |
Find all files under current directory and print their md5 sums | find . -type f -printf '%f ' -exec openssl dgst -md5 {} \; |
find all data files in current folder which have not been changed in the last 60 minutes and display their name without extension | find . -iregex "./[^/]+\.dat" -type f -cmin +60 -exec basename {} \; |
find md5sum of 'string to be hashed' | md5 -s 'string to be hashed' |
Lists all subdirectories in the current directory with the trailing slash removed | ls -d1 */ | tr -d "/" |
Print mount point of the file system containing $path. | df --output=target "$path" | tail -1 |
search for the word "foo" in all the regular/normal files in the directory "/path/to/dir" | find /path/to/dir -type f | xargs grep -l "foo" |
Reports count of characters in the value of ${FOO_NO_EXTERNAL_SPACE} variable as follows: "length(FOO_NO_EXTERNAL_SPACE)==<counted number of characters>" | echo -e "length(FOO_NO_EXTERNAL_SPACE)==$(echo -ne "${FOO_NO_EXTERNAL_SPACE}" | wc -m)" |
display all the files in the folder "/home/mywebsite" which have been changed in the last 7*24 horus | find /home/mywebsite -type f -ctime -7 |
find all files having certain word in its name in the current folder | find . -name "*bsd*" -print |
Give all directories in the /path/to/base/dir tree read and execute privileges | find /path/to/base/dir -type d -print0 | xargs -0 chmod 755 |
Move all *.pdf.marker files and their corresponding *.pdf files under ${INPUT_LOCATION} to ${OUTPUT_LOCATION} | find $INPUT_LOCATION -name '*.pdf.marker' -exec bash -c 'mv ${0%.marker} $0 $1' {} $OUTPUT_LOCATION \; |
Remove all .txt files from the /full/path/dir directory tree | find /full/path/dir -name '*.txt' -exec /bin/rm {} \; |
List the directory paths of all *.ext (case insensitive) files under /path directory | find /path -type f -iname "*.ext" -printf "%h\n" |
change the permission of all the php files in the folder /var/www/ to 700 | find /var/www/ -type f -iname "*.php" -exec chmod 700 {} \; |
List all active cron jobs, displaying only the command. | crontab -l | grep -v "^#" | awk '{print $6}' |
Lists all content in a current folder but names like *.c and *.h. | ls -d ! |
Find every vim undo file under current directory | find -type f -iname '*.un~' |
Find all xml files under current directory and archive them to .bz2 archives | find -name \*.xml -print0 | xargs -0 -n 1 -P 3 bzip2 |
run command 'source myfile; bash' as user root | su -c 'source myfile; bash' |
List all *.txt files/directories under /etc | find /etc -name "*.txt" -ls |
Recursively copy /path/to/foo on host "your.server.example.com" to local directory "/home/user/Desktop", connecting as ssh username "user". | scp -r [email protected]:/path/to/foo /home/user/Desktop/ |
List all files under the current working directory with name ".htaccess" | find `pwd` -name .htaccess |
Find any files in the current directory and its sub-directories that were last accessed more than 7 days or are larger than 20480 blocks in size. | echo find . -atime +7 -o -size +`expr 10 \* 1024 \* 2` -print |
Find regular files under / that contain "stringtofind" | find / -maxdepth 1 -xdev -type f -exec grep -li stringtofind '{}' \; |
get second-to-last comma-separated field of each line in file.txt | cat file.txt | rev | cut -d ',' -f 2 | rev |
display all the ".mov" video files in the current folder in the format filename and folder path | find . -iname "*.mov" -printf "%p %f\n" |
Change to folder where the oracle binary is. | cd $ |
Print content of all files found regarding seach options '[whatever]' | find [whatever] -print0 | xargs -0 cat |
Delete all hidden files/directories under $some_directory including $some_directory | find $some_directory '.*' -delete |
Print the current user name associated with standard input | who -m | awk '{print $1;}' |
Prints long listing of directories '/tmp', '/tnt' themselves. | ls -ld /tmp /tnt |
Find all regular files that reside in the current directory tree and were last modified more than 7 days ago | find . -type f -mtime +7 |
Change directory to "/lib/modules/" of the current kernel release | cd /lib/modules/$(uname -r)/ |
Delete all files under $DESTINATION directory tree that were modified more than 7 days ago | find $DESTINATION -mtime +7 -exec rm {} \; |
Save IP addresses of the host name in variable "ip" | ip=$(hostname -I) |
Find all the files in file system which are changed in last 1 hour | find / -cmin -60 |
Recursively find the latest modified file in the current directory and print the modification time and filename | find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " | sed 's/.*/"&"/' | xargs ls -l |
Find all files/directories named 'имя_файла' in the entire filesystem | find / -name "имя_файла" |
Calculate md5 checksum of theDirname | cpio -i -e theDirname | md5sum |
Print 'bla.txt' if at least one file with such name is present below the current directory. | ls -alFt `find . -name "bla.txt"` | rev | cut -d" " -f1 | rev | head -1 |
returns a list of files create time is 1 minute ago under the root directory. | find / -newerct '1 minute ago' -print |
Find all regular files in minimum 1 level down the $dir directory | find "$dir" -mindepth 1 -type f |
change the permissions of all the directories in the folder root_dir to 555 | find root_dir -type d -exec chmod 555 {} \; |
Write output of "yourcommand" to standard output and to "output.txt" | yourcommand | tee output.txt |
Search in current directory downwards all files whose size is 10 blocks . | find . -size 10 print |
Changes group ownership of '/var/run/fcgiwrap.socket' to 'forge'. | chgrp forge /var/run/fcgiwrap.socket |
Print contents of "file" as space separated hexadecimal bytes on a single line | od -t x1 -An file |tr -d '\n ' |
find all the mp3 files in the entire file system whose size is bigger than 10MB | find / -type f -name *.mp3 -size +10M -exec rm {} \; |
Make directory "backup" | mkdir backup |
View line 500 to line 500 + 501 in gzipped file "bigfile.z" | zcat bigfile.z | tail -n +500 | head -501 |
Attaches to 'test1' tmux session. | tmux attach -t test1 |
Rename all files in current directory whose name starts with 'F0000', trimming a zero from any sequence of four zeroes in the name. | rename s/0000/000/ F0000* |
Display the number of regular files under current directory tree | find . -type f -exec echo {} \; | wc -l |
Calculate the md5 sum of the file "filename" and print only the hash | md5sum filename |cut -f 1 -d " " |
Send 5 pings to broadcast address "10.10.0.255" and print the unique IPs who responded | ping -c 5 -b 10.10.0.255 | grep 'bytes from' | awk '{ print $4 }' | sort | uniq |
Copy the directory structure in "src/" to "dest/" with empty files | find src/ -type d -exec mkdir -p dest/{} \; -o -type f -exec touch dest/{} \; |
Create an empty file with a carriage return character in its name. | echo -e "Icon\\r" | xargs touch |
Creates temporary file with appended suffix '.cmd' and saves path to it in 'LGT_TEMP_FILE' variable. | LGT_TEMP_FILE="$" |
list all *.txt files in the user's home directory. | find ~/ -name '*.txt' |
Load keybindings from a file ~/.inputrc | bind -f ~/.inputrc |
Find files/directories named 'TEST_3' under current directory tree | find -name TEST_3 |
Reports count of characters in the value of ${FOO_NO_TRAIL_SPACE} variable as follows: "length(FOO_NO_TRAIL_SPACE)==<counted number of characters>" | echo -e "length(FOO_NO_TRAIL_SPACE)==$(echo -ne "${FOO_NO_TRAIL_SPACE}" | wc -m)" |
Find all sample* files/directories under current directory and print 'program {}-out {}' where {} will expand to file paths | find . -name "sample*" | parallel --dry-run program {}-out {} |
Search the current directory recursively for .m4a files | find . -type f -iname *.m4a -print |
Count the number of lines in "/etc/fstab" | cat /etc/fstab | wc -l |
Find all *.html files under current directory | find . -type f -name '*.html' |
Find all .php files in the current directory tree | find . -type f -name "*.php" |
Locate OGG files under the home directory larger than 100 megabytes | find $HOME -iname '*.ogg' -size +100M |
display the name of all directories in the current folder and do not search in sub directories | find . -type d -maxdepth 1 -mindepth 1 -exec basename {} \; |
Find all files/directories under /non-existent/directory directory with ~/bin/find | ~/bin/find /non-existent/directory -name '*.plist' -print |
Copy directory structure from directory 'olddir' to 'newdir' | find olddir -type d -printf "newdir/%P\0" | xargs -0 mkdir -p |
Change the owner and group of "testfile.txt" to "root" | sudo chown root:root testfile.txt |
Make directory "destdir" | mkdir destdir |
list regular files ending in .mbox | find . -type f -wholename \*.mbox |
Remove the files or directories 'bin/node', 'bin/node-waf', 'include/node', 'lib/node', 'lib/pkgconfig/nodejs.pc' and 'share/man/man1/node' with superuser privilege | sudo rm -rf bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node |
Force create a hard link in "/usr/local/bin" to "findpdftext" | sudo ln -f "findpdftext" /usr/local/bin |
Append the last modification time of file $arg as the seconds since epoch with a preceding space to the variable 'KEY' | KEY+=`date -r "$arg" +\ %s` |
Read a single character from standard input with prompt "Is this a good question ?" and save the response to variable "answer" | read -n 1 -p "Is this a good question ? " answer |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.