nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Print file type of the command "c++"
|
file `which c++`
|
Search for files/directories which are writable by both their owner and their group
|
find . -perm -g+w,u+w
|
Find all files with the SUID bit set
|
find / -perm -u+s
|
Create symlinks to all /home/folder1/*.txt files with the same name in current directory
|
find /home/folder1/*.txt -type f -exec ln -s {} \;
|
Search the system for 'dead' symbolic links
|
find / -type l -print | perl -nle '-e || print';
|
Report total file systems disk usage.
|
df --total | tail -n 1
|
Count the number of lines in all ".txt" files
|
cat *.txt | wc -l
|
Archive the list of 1st level subdirectories in /fss/fin to /fss/fi/outfile.tar.gz
|
tar -czf /fss/fi/outfile.tar.gz `find /fss/fin -d 1 -type d -name "*" -print`
|
Find files starting with the word "file" in the current directory tree
|
find . -name "file*"
|
Find all 100MB+ files and delete them
|
find / -size +100M -exec rm -rf {} \;
|
Gets MAC address of en0 network interface.
|
ifconfig en0 | grep -o -E '{5}[[:xdigit:]]{1,2}'
|
ssh into "hostname" as user "buck"
|
ssh buck@hostname
|
Search the current directory tree for files whose names contain "TextForRename"
|
find ./ -name "*TextForRename*"
|
Display a long listing of all the regular files in the file system which belong to user 'root' and which have suid bit set
|
find / -type f -user root -perm -4000 -exec ls -l {} \;
|
Print the file system "file/goes/here" is on
|
df -P file/goes/here | tail -1 | cut -d' ' -f 1
|
Create a symbolic link named "$HOME/bin/" to "$HOME/downloads/fnord"
|
ln -s $HOME/downloads/fnord $HOME/bin/
|
find all the regular/normal files in the current folder which belong to the group "flossblog"
|
find . -group flossblog -type f
|
Find all files under current directory and change their permission to 644
|
find . -type f -exec chmod 644 {} \;
|
find all .bak files in or below the current directory and move them to ~/.old.files directory:
|
find . -name "*.sh" -print0 | xargs -0 -I {} mv {} ~/back.scripts
|
Find all '*~' files under current directory and delete them
|
find ./ -name '*~' | xargs> rm
|
run command "/usr/bin/psql database -c \"SELECT 'DROP TABLE ' || .... " as user postgres
|
su - postgres -c "/usr/bin/psql database -c \"SELECT 'DROP TABLE ' || .... "
|
Create intermediate directories "x" and "p" as required and create "q"
|
mkdir -p x/p/q
|
Change permissions of ".git/hooks/pre-commit" to 777
|
sudo chmod 755 .git/hooks/pre-commit
|
Search *.x files from the current directory tree for string "fred"
|
find . -name ‘*.x’ -print0 | xargs -0 grep fred
|
Save a nginx link to "/path/to/file" with the current user and system FQDN host name in variable "path"
|
path="http://$(whoami).$(hostname -f)/path/to/file"
|
Change permissions of ".bash_logout", ".bashrc", and ".profile" to 444
|
chmod 444 .bash_logout .bashrc .profile
|
Print the contents of "filename"
|
cat filename
|
Uncomment every entry in current user's cron job list which contains "test.sh"
|
crontab -l | sed '/# *\([^ ][^ ]* *\)\{5\}[^ ]*test\.sh/s/^# *//' | crontab -
|
Finds all logged in users.
|
w | awk '{print $1}'
|
Print a list of most often changed files in git
|
git whatchanged --all | \grep "\.\.\." | cut -d' ' -f5- | cut -f2- | sort | uniq -c | sort
|
List the current directory recursively ignoring the "dir1" subdirectory
|
find . -path ./dir1\* -prune -o -print
|
Search for case-insensitive "string" in "log.tar.gz"
|
zcat log.tar.gz | grep -a -i "string"
|
find all files in the current folder which have not been accessed in the last 30 days in the current folder
|
find . -atime +30 -print
|
delete all the log files in the current folder
|
find -name '*.log' -delete
|
search for all text files in the folder /home
|
find /home -name *.txt
|
Change owner to "$user" and group to "$group" of "$file"
|
chown -- "$user:$group" "$file"
|
Remove all .sh files in the current directory tree whose names begin with "t"
|
find . -name "t*.sh" -exec rm -vf '{}' \;
|
Find files on the system bigger than 50MB but smaller than 100MB
|
find / -type f -size +50M -size -100M
|
Write output of "ls -lR /" to standard output and append to "output.file"
|
ls -lR / | tee -a output.file
|
Recursively finds and compresses all files in the directory '/path/to/dir'
|
find /path/to/dir -type f -exec bzip2 {} \;
|
Find files/directories in entire file system with at least 644 permission
|
find / -perm -644
|
List the current directory recursively ignoring the "dir1" subdirectory
|
find . -path ./dir1\* -o -print
|
Move "file.txt" to docker container "$COUNTAINER_ID" in path "/var/lib/docker/aufs/mnt/$CONTAINER_ID/rootfs/root/file.txt"
|
mv -f file.txt /var/lib/docker/aufs/mnt/$CONTAINER_ID/rootfs/root/file.txt
|
Find all directories under $x directory and set read-write-execute permission for owner and group and no permission for other for those directories
|
find ${x} -type d -exec chmod ug=rwx,o= '{}' \;
|
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"
|
Run 'chmod 0755' on all directories in the current directory tree
|
find . -type d -exec chmod 0755 {} \;
|
split file data.csv into pieces per 100 lines
|
split -l 100 date.csv
|
Find all directories matching the regex '.texturedata' in their names under '/path/to/look/in/' directory tree
|
find /path/to/look/in/ -type d | grep .texturedata
|
Find directories in the current directory and print them appended with a string literal 'Directory: '
|
find . -maxdepth 1 -type d -print | xargs -I "^" echo 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 \;
|
find all the files ending with emlx in a folder and save the output to a list file
|
find /path/to/folders/ -name \*.emlx -print0 > filelist
|
Look for "testfile.txt" in the "/" directory and 1 level below
|
find / -maxdepth 2 -name testfile.txt
|
Removes 'folderName', and removes all content within if 'folderName' is folder.
|
rm -rf folderName
|
Print as many dots as there are files named "file.ext" in the /home/kibab directory tree
|
find /home/kibab -name file.ext -exec echo . ';'
|
Print the unique lines from standard input preserving the order they appear
|
nl -n ln | sort -u -k 2| sort -k 1n | cut -f 2-
|
Find all *.csv files under /foot/bar/ and move them to some_dir
|
find /foot/bar/ -name '*.csv' -print0 | xargs -0 mv -t some_dir
|
Send every 130 characters of "file" as input to "..."
|
fold -w130 file | ...
|
Locate the httpd.conf file on the system
|
find / -name httpd.conf
|
Takes path list from '.exportfiles.text' file, cuts off first two path segments and last one.
|
cut -d / -f 4- .exportfiles.text | xargs -n 1 dirname
|
Change permissions for all PHP files under the current directory tree to 755 and print the number of files changed
|
find . -name "*.php" -exec chmod 755 {} + -printf '.' | wc -c
|
find all the php files in current folder using regular expressions
|
find . -regex '.+\.php'
|
Find and remove all .txt regular files under the current directory and below
|
find . -type f -name "*.txt" -exec rm -f {} \;
|
Find all *.ogg (case insensitive) files under your home directory that are less than 100MB in size
|
find $HOME -iname '*.ogg' -type f -size -100M
|
Search the /Path/bar* directories recursively for files matching pattern "file_name*"
|
find /Path/bar* -name "file_name*"
|
Find all *.ogg (case insensitive) files/directories under your home directory
|
find $HOME -iname '*.ogg'
|
Send email with subject "Backup" and attachment "mysqldbbackup.sql" and message in "message.txt" to "[email protected]"
|
cat message.txt | mail -s "Backup" -a mysqldbbackup.sql [email protected]
|
search for all the mp3 files in the current folder and change the character encoding of them to <source-encoding>
|
$ find . -name "*mp3" -print0 | xargs -0 mid3iconv -e <source-encoding> -d
|
Find all files that aren't owned by user www-data
|
find -not -user www-data
|
Search for the Perl regex "[\x80-\xFF]" in *.xml files under current directory tree
|
find . -name *.xml | xargs grep -P "[\x80-\xFF]"
|
print the last word in a.txt
|
tac a.txt | awk 'NF{print $NF; exit}'
|
Search the current directory recursively for files whose size is between 10 and 50 MB
|
find . -size +10M -size -50M -print
|
List all aliencoders.[0-9]+ files/directories under /home/jassi/ directory
|
find /home/jassi/ -name "aliencoders.[0-9]+" 2>&1 | xargs ls -lrt | awk '{print $9}'
|
display all the text files in a folder
|
find $1 -type f -name '*'$n'.txt'
|
Find all directories in the /data1/realtime directory tree that were modified within the last 60 minutes
|
find /data1/realtime -mmin -60 -type d
|
Find all *.mp3 files under current directory
|
find . -name *.mp3
|
Print all files with a '-' after their name if they are regular files, and a '+' otherwise
|
find / -type f -exec echo {} - ';' -o -exec echo {} + ';'
|
Unzip and merge all "small-*.gz" files into files of 2000000 lines
|
zcat small-*.gz | split -d -l2000000 -a 3 - large_
|
display a long list and delete all the regular/normal files in the current folder starting with the word k which have been modified in the last 4 hours
|
find . -type f -name “k*.*” -mmin -360 -exec ls -l ‘{}’ ; | xargs -0 /bin/rm -f
|
Print the files to which symbolic links in the current directory point
|
find . -type l -print | xargs ls -ld | awk '{print $10}'
|
find all the core files in the entire file system and delete them
|
find / -name core -exec rm -f {} \;
|
Report file system containing the current directory disk usage
|
df .
|
Find all files in the current directory tree whose names are ".DS_STORE"
|
find . -name ".DS_STORE"
|
Find regular files with permissions less than 111
|
find -perm -111 -type f
|
Find all files/directories under current directory tree wihout descending into './src/emacs' directory
|
find . -path './src/emacs' -prune -o -print
|
sleep for 10 seconds
|
sleep 10
|
Find files/directories writable by group and others under the /path directory
|
find /path -perm -go+w
|
Find all the files in the current directory
|
find * -type f -print -o -type d -prune
|
Search the /usr/local/doc directory tree for .texi files
|
find /usr/local/doc -name '*.texi'
|
find the type of all the regular/normal files in the current folder
|
find . -type f -exec file {} \;
|
Search the /path directory tree for files having permissions 777
|
find /path -perm ugo+rwx
|
Print all business days in the current month without column titles
|
cal -h | cut -c 4-17 | tail -n +3
|
Find recursively all files in the "." directory tree whose names end with ".class" and delete them
|
find . -type f -name "*.class" -exec rm -vf {} \;
|
Locate logo.gif in the /var/www directory tree
|
find /var/www -name logo.gif
|
Print 3 space separated '%'
|
echo $(yes % | head -n3)
|
Automatically log into "SOME_SITE.COM" on port 2400 as user "YOUR_USERNAME" using password "YOUR_PASSWORD"
|
sshpass -p "YOUR_PASSWORD" ssh -o StrictHostKeyChecking=no YOUR_USERNAME@SOME_SITE.COM:2400
|
List screen IDs
|
screen -ls
|
Find all the files whose permissions are 777 in the current directory
|
find . -type f -perm 0777 -print
|
Find all directories with space in their names under current directory and rename them by replacing all spaces with _
|
find -name "* *" -type d | rename 's/ /_/g'
|
Get the disk space used by all *.txt (case insensitive) files/directories under current directory
|
find . -iname "*.txt" -exec du -b {} + | awk '{total += $1} END {print total}'
|
Find files modified more recently than file poop
|
find . -newer poop
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.