nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
find the "MyCProgram.c" file under the current directory | find -iname "MyCProgram.c" |
find files in current folder using name patterns and sort the display the file names in the sorted order | find . -name "S1A*1S*SAFE" | rev | awk -F '/' '{print $1}' | rev | sort -t _ -k 5 |
Creates temporary file and saves path to it in 'content_dir1' variable. | content_dir1=$(mktemp) |
Recursively copy all files matching "*.sh" in "$from" to "root@$host:/home/tmp/" compressing data during transmission | rsync -zvr --exclude="*" --include="*.sh" --include="*/" "$from" root@$host:/home/tmp/ |
Search the current directory recursively for files last modified within the past 24 hours ignoring .swp files and paths ./es* and ./en* | find "$(pwd -P)" -mtime 0 -not \( -name '*.swp' -o -regex './es.*' -o -regex './en.*' \) |
Starts tmux session 'name', forcing tmux to assume the terminal supports 256 colours, and executes defined script within. | tmux -2 new-session -s name "another_script.sh $1" |
list all files under the current directory, writing the output to the file files_and_folders, suppressing all error messages | find . 2>/dev/null >files_and_folders |
Find all *.txt files/directories under current directory discarding 'Permission denied' errors | find . -name "*.txt" -print | grep -v 'Permission denied' |
find all the symbolic links in the current folder and check the file type and display the names of files which are broken | find . -type l -exec sh -c "file -b {} | grep -q ^broken" \; -print |
delete all the files in the file system which belong to the user edwarda | find / -user edwarda -exec rm "{}" \; |
list all system calls during process of symbolic link creation process on "/tmp/output.txt" file | strace -o /tmp/output.txt ln -s -f .bash_aliases test |
find all the php files in current folder and search for multiple patterns in these files and display the file names | find -name '*.php' -exec grep -in "fincken" {} + | grep TODO | cut -d: -f1 | uniq |
Set variable "MAVEN_DEBUG_OPTS" to "-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" on Windows machines | set MAVEN_DEBUG_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 |
Ping hostname, grep for 192.168.11 and print the IP from the output | ping -c 1 hostname | grep 192.168.11 | grep 'bytes from' | awk '{print $4}' | sed 's/://g' |
Recursively changes group ownership of every folder in a current directory to the name of that folder. | find . -type d | sed -e 's/^\.\///g' -e 's/^\./avoid/g' | grep -v avoid | awk '{print $1"\t"$1}' | xargs chgrp |
Find the file in the current directory tree with inode number $inum and delete it | find . -inum $inum -exec rm {} \; |
Print the full path prefix for all files in the current directory tree as a list | tree -fi |
recursively change owner and group of the directory and all files into it to user "user" and group "www-data" | chown -R user:www-data yourprojectfoldername |
create directory tata | mkdir tata |
Shuffles strings of text received by 'awk' command on the input. | awk 'BEGIN{srand;} {printf "%06d %s\n", rand*1000000, $0;}' | sort -n | cut -c8- |
Find all php files whose name is tecmint.php in a current working directory | find . -type f -name tecmint.php |
List all files/directories in entire file system | find / -print |
Find all *.ext files/directories under current directory and print their path and parent directory path | find . -name '*.ext' | parallel echo {} '`dirname {}`' |
Compress a file named '{}' in the current directory | gzip "{}" |
Delete all hidden files in the directory tree given as variable $FOLDER | find $FOLDER -name ".*" -delete |
Find all files/directories under current directory with null character as the delimiter | find -print0 |
Copy "/new/x/y/z/" over the network to "user@remote:/pre_existing/dir/" preserving the directory hierarchy | rsync -a --relative /new/x/y/z/ user@remote:/pre_existing/dir/ |
Copy the directory hierarchy from "original" to "new" | find original -type d -exec mkdir new/{} \; |
Find all files under current directory that were modified more than 1 day ago | find -mtime +1 |
list directories owned by group ID 100 in the file system | find / -type d -gid 100 |
change the ownership of all the files in the file system from edwarda to earnestc | find / -user edwarda -exec chown earnestc "{}" \; |
Changes group ownership of 'myprogram' to ${USER} (the current user) | chgrp "${USER}" myprogram |
Extract the second-to-last slash-separated path component, ie. "90_2a5" in this case. | echo 'test/90_2a5/Windows' | xargs dirname | xargs basename |
Remount root filesystem "/" | mount -oremount / |
Exclude directory from find . command | find . -name '*.js' -and -not -path directory |
find all the files in the current directory which have been modified in the last 30 days and display the contents. | find . -atime +30 -exec ls \; |
Finds IP addresses of all network interfaces. | ifconfig | grep -v '127.0.0.1' | sed -n 's/.*inet addr:\([0-9.]\+\)\s.*/\1/p' |
Print the list of regular files in the current directory and all subdirectories | find . -type f |
Displays a tree of all process alongside their command line arguments. | pstree -a |
Gets IP address of 'eth0' network interface. | ifconfig eth0 | awk '/inet addr/{sub; print $1}' |
Starts new tmux session, assuming the terminal supports 256 colours. | tmux -2 |
Change permissions to 644 for all files in the current directory tree | find . -type f | xargs chmod -v 644 |
Find the password file between sub-directory level 2 and 4 | find -mindepth 3 -maxdepth 5 -name passwd |
remove all files that's older than 30 days in '/tmp' | find /tmp -type f -mtime +30 -exec rm -f {} \; |
find all normal/regular files in current folder and display the total lines in them | find . -type f -exec wc -l {} + |
Decompress "/file/address/file.tar.gz" to standard output | gzip -dc /file/address/file.tar.gz |
Print characters in variable "$a" that exist in variable "$b" | echo "$(comm -12 < < | tr -d '\n')" |
List all files and directories in the /home directory tree whose names are "Trash" | find /home -name Trash -exec ls -al {} \; |
Remove files cart4, cart5, cart6 in directory ~/junk | find ~/junk -name 'cart[4-6]' -exec rm {} \; |
Search for 'Processed Files' in all $srch* files under current directory run the sed script 'N;s/\n/\2 \1/' on the output and redirect the final output to temp2 file | find . -iname "$srch*" -exec grep "Processed Files" {} \; -print| sed -r 'N;s/\n/\2 \1/' > temp2 |
Find all files starting from / that belong to user1 | find / -user user1 |
Find recursively the latest modified file in the current directory | find . -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" " |
Find files whose content was modified at least 1 minute ago | find ./ -mmin +1 |
Remove all but 5 last comma-separated fields from each line in 'data.csv' | cat data.csv | rev | cut -d, -f-5 | rev |
Find all directories in /var/www/html/zip/data/*/*/*/*/* that are older than 90 days and print only unique paths | find /var/www/html/zip/data -type d -mtime +90 | uniq |
Prints process tree, showing only strings with 'MDSImporte', and chopping output after ${WIDTH} characters. | pstree | grep MDSImporte | cut -c 1-${WIDTH} |
Find all .zip files in the current directory tree and unzip them | find . -depth -name '*.zip' -exec /usr/bin/unzip -n {} \; |
Print the path names of all files and directories in the current directory tree | find -printf '"%h/%f" ' |
Save in QUEUE_PIDS variable only pid numbers that stored in $NEW_PIDS variable | QUEUE_PIDS=$(comm -23 < < | grep -v '^$') |
Give a long listing of all the *.pl files beneath the current directory. | find . -name "*.pl" -exec ls -ld {} \; |
List all leaf directories of the current directory tree | find . -type d | sort | awk '$0 !~ last "/" {print last} {last=$0} END {print last}' |
search all the files in the current folder using name patterns | find . -name 'a(b*' -print |
Prompt user to type a list of cron jobs directly at the terminal, then use these replacing previously existing cron jobs. | crontab |
Find out all *.sh owned by user vivek | find / -user vivek -name "*.sh" |
find all the files in the current folder which end with "ext1" or "ext2" or "ext3" | find -E . -regex ".*ext1|.*ext2|.*ext3" |
Set the permissions of all directories inside the current directory tree to u=rwx,g=rx,o=x | find . -type d -exec chmod u=rwx,g=rx,o=x {} \; |
Find all *.txt files/directories under current directory | find . -name "*.txt" -print |
Change the owner to "user" and group to "group" of files "file ..." | chown user:group file ... |
Search for 'some string' in all *.axvw files under current directory and show the matched lines with line numbers | find . -name '*.axvw' -exec grep -n 'some string' {} + |
Find all directories under /path/to/base/cache, /path/to/base/tmp, /path/to/base/logs and change their permission to 755 | find /path/to/base/cache /path/to/base/tmp /path/to/base/logs -type d -exec chmod 755 {} + |
find all text files in the current directory and display them page wise | find . -name "*.txt" -print |
find all of the files that are readable | find / -readable |
Find all files in the current directory tree whose size is greater than 1MB, and move them to the "files" folder | find . -size +1M -exec mv {} files \+ |
Counts all *.mod files in a /boot/grub/ folder. | ls -l /boot/grub/*.mod | wc -l |
Interpret in the current shell all lines in config.sh which contain the word "marker" | source <( grep "marker" config.sh ) |
Find disk used space of only the target directory | du --max-depth=0 ./directory |
Find all .txt files in the current directory tree and edit them with `vim' | find . -name "*.txt" | parallel -j1 --tty vim |
Make all the bugzilla subdirectories permission 775 | find bugzilla -type d -exec chmod 775 {} \; |
Find all .gif files in the /var/www directory tree | find /var/www -name *.gif |
Display all variables with names starting with "derby" in a Window's command line | set derby |
Print details for all files in the ./work directory tree with extension .sh that were modified less than 20 days ago | find ./work/ -type f -name "*.sh" -mtime -20 | xargs -r ls -l |
Update timestamps of all files (not directories) under current directory. | find . -exec touch {} \; |
Find "*prefs copy" files in the /mnt/zip directory tree and remove them | find /mnt/zip -name "*prefs copy" -print0 | xargs rm |
Remount "/mnt/mountpoint" with read and write permission | mount /mnt/mountpoint -oremount,rw |
Find all files/directories named 'articles.jpg' under 'images' directory tree | find images -name "articles.jpg" |
Sort and compare files "$def.out" and "$def-new.out" | diff < < |
display all the files having the word "searched phrasse" in their name in the current folder excluding those from the paths "/tmp/" and "./var/log" | find . -type f -name "*searched phrasse*" ! -path "./tmp/*" ! -path "./var/log/*" |
Find all sample*_1.txt files/directories under current directory and print 'program sample*-out sample*_1.txt sample*_2.txt' for each of them | find . -name "sample*_1.txt" | sed -n 's/_1\..*$//;h;s/$/_out/p;g;s/$/_1.txt/p;g;s/$/_2.txt/p' | xargs -L 3 echo program |
Automatically log into "SOME_SITE.COM" as user "YOUR_USERNAME" using password "YOUR_PASSWORD" | sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM |
Clean the current directory from all subversion directories recursively | find . -type d -name ".svn" -print | xargs rm -rf |
Find regular files larger than 500MB in the current directory tree | find . -type f -size +500M |
Prints long listing of file 'file.ext'. | ls -al file.ext |
Replace "," with "\r\n" in "a,b" | echo "a,b"|sed 's/,/\r\n/' |
Find all files and directories whose names end in ".rpm" and change their permissions to 755 | find / -name *.rpm -exec chmod 755 '{}' \; |
Send 5 ping requests to address 12.34.56.78 and print only the last 2 lines of the summary output. | ping -c 5 -q 12.34.56.78 | tail -n 2 |
Archive "/path/to/application.ini" on host "source_host" to current directory. | rsync -avv source_host:path/to/application.ini ./application.ini |
Filnd all directory in root directory with 777 permission and change permision755 with chmod commad . | find / -type d -perm 777 -print -exec chmod 755 {} \; |
find directory which case-insensitive name is too in currect directory | find . -iname foo -type d |
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 |
display all the regular files in current folder that belong to the user "tom" | find . -type f -user tom |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.