nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
List files larger than 10MB under /var/log /tmp that haven't changed in a month | find /tmp /var/tmp -size +30M -mtime 31 -print0 | xargs -0 ls -l |
display all the directories in the folder /path/to/dest except tmp and cache directories | find /path/to/dest -type d \ -o \ -print |
Execute all arguments to a shell script and write the output to console and "$FILE" | $@ | tee $FILE |
find a specfic video file in the current directory | find ./ -name "foo.mp4" -exec echo {} \; |
change the permissions of all the directories in the folder root_dir to 555 | find root_dir -type d -exec chmod 555 {} \; |
Find all fglrx-libGL* files under and below debian/fglrx/ | find debian/fglrx/ -name 'fglrx-libGL*' |
find all regular/normal files which have execute permission in current folder and copy them to another folder | cp `find -perm -111 -type f` /usr/local/bin |
find all files in the home folder which have been modified between 72 and 96 hours before | find ~ -mtime 2 -mtime -4 -daystart |
Split "data.tsv" into files of at most 5000000 lines each with prefix "_tmp" | split -l5000000 data.tsv '_tmp'; |
Prints folder where current script is located | echo "dirname: `dirname "$0"`" |
Find all directories containing 'linux' in their names under '/root' directory tree | find /root -type d -iname "*linux*" |
Counts all *.mod files in a /boot/grub/ folder. | ls -l /boot/grub/*.mod | wc -l |
find all files ending with ".fq" and give is as input to the fastQC command | find . -name "*.fq" | xargs -n 1 fastqc |
force delete all the files which have not been accessed in the last 240 hours in the temp folder | find /tmp/* -atime +10 -exec rm -f {} \; |
Find all *.txt files/directories under current directory and execute process once with all of them as arguments | find . -name \*.txt -print0 | xargs -0 process |
Find all *.xml files under current directory | find -name *.xml |
Find all directories under minimum 2 levels down the mydir directory | find mydir -mindepth 2 -type d |
Delete all empty directories and directories that contain only empty directories under current directory | find -type d -empty -exec rmdir -vp --ignore-fail-on-non-empty {} + |
Save the current working directory and the directory name of the current script to variable "DIR" | DIR=`pwd`/`dirname $0` |
Print revesed second from the end dot-bounded field in $i value | j=`echo $i | rev | cut -d "." -f2`; |
Find writable regular files in the current directory | find . -maxdepth 1 -type f -writable |
Saves byte size of all content of $1 folder in 'uiTotalSize' variable. | uiTotalSize=$(ls -l -R $1 | grep -v ^d | awk '{total+=$5;} END {print total;}') |
find all the files that have been modified in the last 12 hours | find ./ -mtime -0.5 |
Compress in parallel regular files in the current directory tree that were last modified more than 7 days ago | find . -type f -mtime +7 | tee compressedP.list | xargs -I{} -P10 compress {} & |
delete recursively, without prompting, any files or directories under the current directory that case insensitively match the filename ".svn" | find . -iname .svn -print0 | xargs -0 rm -rf |
Write the current date and time followed by " 0" to the console and append to "log.csv" | echo $ "0" | tee -a log.csv |
find all the files in the home folder which have been modified today | find ~ -type f -mtime 0 |
Delete all files in the "${S}/bundled-libs" folder except "libbass.so" | find "${S}/bundled-libs" \! -name 'libbass.so' -delete |
search for the directory "uploads" in current folder and change the permission of the folder and all the files to 755 | find . -type d -name 'uploads' | while read d; do chmod -R 755 "$d"; done |
find all files in current folder which are less than 300MB | find . -size -300M |
Write "error" to standard output | echo "error" | tee |
Replace "foo" with "bar" in all PHP files in the current directory tree | find . -name "*.php" -print | xargs sed -i 's/foo/bar/g' |
delete all the regular files in the temp folder which have not been modified in the last 24 hours | find /tmp/ -type f -mtime +1 -exec rm {} \; |
Search directory tree $DIR for *.txt files | find "$DIR" -name \*.txt |
move files accessed more than one day ago to directory TMP | find . -atime +1 -type f -exec mv {} TMP \; # mv files older then 1 day to dir TMP |
Prints shell option 'globstar' with indication of its status. | shopt -p globstar |
Find regular files that have SUID or SGID set | find / -perm +6000 -type f |
Search the current directory tree for all files except SVN ones | find . -not -iwholename '*.svn*' |
Move all files including hidden files in "/path/subfolder/" to "/path/" | mv /path/subfolder/{.,}* /path/ |
Copy directory hierarchy "dir" and all its .txt files to "dir_txt" | find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents |
Sets shell option 'nullglob'. | shopt -s nullglob |
list the details of all the directories in the current folder | find . -type d -exec ls -ld {} \; |
Find all files under trunk directory and upload them to https://PATH_TO_NEXUS/trunk/ | find trunk -type f -exec curl --user user:pass --ftp-create-dirs -T {} https://PATH_TO_NEXUS/{} \; |
Find files/directories named 'sar' under '/usr', '/bin', '/sbin' and '/opt' directory tree | find /usr /bin /sbin /opt -name sar |
Write contents of "/sys/kernel/debug/tracing/trace_pipe" to standard output and to "tracelog.txt" executing as a root user | sudo cat /sys/kernel/debug/tracing/trace_pipe | tee tracelog.txt |
Print "echo ping -c 2" on each string in file 'ips' | cat ips | xargs echo ping -c 2 |
Print the last 1000 lines of all files matching "/var/spool/cron/*" | tail -n 1000 /var/spool/cron/* |
find all the files ending with ".coffee" in the current folder and search for the first occurence of the word "re" in each line | find . -name '*.coffee' -exec awk '/re/ {print;exit}' {} \; |
Join data in "file1" sorted by the second word of each line with data in "file2" sorted by the first word of each line, keeping the same order as it is found in "file1" | join -1 2 -2 1 <(sort +1 -2 file1) <(sort +0 -1 file2) |
Find all files under "/path" that do not contain a "." and append ".jpg" to their file name | find /path -type f -not -name "*.*" -print0 | xargs -0 rename 's/$/$1.jpg/' |
Search the current directory for files whose names start with "messages." ignoring SVN files | find \( -name 'messages.*' ! -path "*/.svn/*" \) -exec grep -Iw uint {} + |
find all files & dircetiry in current directory which have .tmp extension and delete them . | find . -type f -name "*.tmp" -exec rm -rf {} \; |
search for all regular/normal files in the current folder and display the number of lines in the file | find . -type f -print0 | xargs -0L1 wc -l |
search for a shell script in the current folder and display the current folder path | find . -name onlyme.sh -exec pwd \; |
Search the regular files of the current directory tree for string "foo" | find . -type f -exec grep "foo" '{}' \; |
find all the files which have been changed after the modification of a file. | find -cnewer /etc/fstab |
display all the regular files in the current folder which have the permission 777 | find . -type f -perm 777 |
Searches available packages by word 'zsh'. | yum search zsh |
Send each byte in "/home/cscape/Desktop/file" to awk script "x.awk" | fold -1 /home/cscape/Desktop/file | awk -f x.awk |
Search the files from the current directory tree for "chrome" | find . -exec grep chrome {} \; |
create an archive and show a progress bar | tar -c --checkpoint=.1000 /var |
Delete all .svn files/directories under current directory | find . -name .svn -exec rm -rf '{}' \; |
Find files matching an exact set of permissions | find / -perm 644 |
Delete all files/directories taken by the glob pattern * except the ones with the name 'b' | find * -maxdepth 0 -name 'b' -prune -o -exec rm -rf '{}' ';' |
display all files in the folder /usr/src excluding those ending with ",v" | find /usr/src ! \( -name '*,v' -o -name '.*,v' \) '{}' \; -print |
Search the files from the current directory tree for "foo" | find . -exec grep foo {} + |
List files in the current directory tree which have permissions rwx for user and rw for group and others | find . -perm 766 -exec ls -l {} \; |
display all regular/normal files in the current folder which are not accessed in the last 7*24 hours | find . -type f -atime +7 |
Find target.out files starting from /starting/path and pass them as arguments to /path/to/simpleGrepScript.sh | find /starting/path -name target.out | xargs /path/to/simpleGrepScript.sh |
Print content of 'whatever' file | cat whatever | egrep 'snozzberries|$' |
Find and remove the .rhosts file in the /home directory tree | find /home -name .rhosts -print0 | xargs -0 rm |
Set variable "architecture" to machine architecture, ie. x86_64 | architecture="$(uname -m)" |
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 {} + |
find all instances of a file in current folder and display all errors apart from permission denied | find . -name "my.txt" 2>&1 | grep -v "Permission denied" |
Find all target files outside the current working directory with symbolic links in the current working directory | find . -type l -exec readlink -f '{}' \; | grep -v "^`readlink -f ${PWD}`" |
Get a list of all files in the /home directory tree and their coressponding inode numbers | find /home -type f -printf "%i@%p\n" |
find not case sensitive all directories that names are 'apt' | find / -type d -iname "apt" |
find all the files in the current directory which have been accessed in the last 1 day and move them to TMP folder. | find . -atime +1 -type f -exec mv {} TMP \; |
find all gzip files in a folder | find /home/foo -name "*.gz" |
find all the files in the current folder that have a single letter in their name which have been modified in the last 3 days but not today | find . -name \? -daystart -mtime +0 -mtime -3 |
Search the .java files from the current directory tree for TODO lines | find . -name "*.java" -exec grep -Hin TODO {} \; |
Copies all files like "*FooBar*" under the current directory to the '~/foobar' directory. | find . -name '*FooBar*' -exec cp -t ~/foobar -- {} + |
List all files/directories under current directory | find -ls |
Highlights current day in a month calendar with color. | cal -h | sed "s/$/"$'\033\[94m&\033\[0m/g' |
Recursively change owner to "amzadm" and group to "root" of all files in "/usr/lib/python2.6/site-packages/awscli/" | chown amzadm.root -R /usr/lib/python2.6/site-packages/awscli/ |
Delete all hidden files/directories under $some_directory including $some_directory | find $some_directory '.*' -delete |
Delete 'string_to_find' from all files under current directory | find . -type f | xargs grep 'string_to_find' -sl | xargs perl -pi -w -e 's/string_to_find//g;' |
List all files in /home/bozo/projects directory tree that were modified exactly one day ago. | find /home/bozo/projects -mtime 1 |
Run 'join' on file1 and file2, using a literal tab character as field separator. | join -t $'\t' file1 file2 |
Find all files under /path and below executable by `group' or `other' | find /path -perm /011 |
Print "echo ping -c 2" on each string in file 'ips' | cat ips | xargs -n1 echo ping -c 2 |
Format time string @1267619929 according to default time format | date -d @1267619929 |
change the owner of all the files in the file system which belong to the user with the uid 999 | find / -user 999 -exec chown NEWUSER {} \; |
Export variable "JAVA_HOME" as symlink resolved absolute path of two parent directories above "/usr/bin/javac" | export JAVA_HOME=$ |
Send one ping request to host whose name or IP address is specified by variable "ip", using network interface eth9. | ping ${ip} -I eth9 -c 1 |
Search for first match of the regex 're' in all *.coffee files under current directory | find . -name '*.coffee' -exec awk '/re/ {print;exit}' {} \; |
Write '"myname="Test"' to the console and append to "$CONFIG" as root | echo "myname=\"Test\"" | sudo tee --append $CONFIG |
Gets IP address of 'en0' network interface. | ifconfig en0 | awk '$1 == "inet" {print $2}' |
Change permissions to 644 for all regular files in and below the current directory | find . -type f -print | sed -e 's/^/"/' -e 's/$/"/' | xargs chmod 644 |
Find all regular files under $DIR/tmp/daily/, sort them in reverse numerical order and copy the first two files to $DIR/tmp/weekly/ | find $DIR/tmp/daily/ -type f -printf "%p\n" | sort -rn | head -n 2 | xargs -I{} cp {} $DIR/tmp/weekly/ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.