nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Remove blank lines and replace " " with "/" in "struct.txt" as input to make directories with parents as needed
|
sed '/^$/d;s/ /\//g' struct.txt | xargs mkdir -p
|
Find all files/directories under current directory that match the case insensitive extended regex .*/(EA|FS)_.*
|
find -E . -iregex '.*/(EA|FS)_.*'
|
Add read permission for 'other' for all files/directories named 'rc.conf' under current directory tree
|
find . -name "rc.conf" -exec chmod o+r '{}' \;
|
get a PID of a process
|
jobs -x echo %1
|
List all IP addresses assigned to current hostname, pausing for user interaction after each page.
|
more /etc/hosts | grep `hostname` | awk '{print $1}'
|
create a backup of all the files in the current folder to the floppy and save the file list in the file /tmp/BACKUP.LOG
|
find . -cpio /dev/fd0 -print | tee /tmp/BACKUP.LOG
|
Change permissions to 644 for all subdirectories
|
find . -type d -print0|xargs -0 chmod 644
|
display all the files in the file system which belong to the user "wnj" or which are modified after the file "ttt"
|
find / \( -newer ttt -or -user wnj \) -print
|
SSH into "myhost.com" as user "myname" with a check every 60 seconds that the server is still alive
|
ssh -o ServerAliveInterval=60 [email protected]
|
Generates temporary file name with full path by template 'fifo.XXXXXX' and saves it to variable 'fifo_name'
|
fifo_name=$(mktemp -u -t fifo.XXXXXX)
|
Identify files that do not have a listing in the /etc/passwd or /etc/group file
|
find / -nouser -o -nogroup
|
search the entire file system for the file "jan92.rpt"
|
find / -name jan92.rpt -print
|
Search the dir_data directory and all of its sub-directories for regular files and remove the execute permission for all while adding the write permission for the user.
|
find ~/dir_data -type f -exec chmod a-x,u+w {} \;
|
Find and print the names of all files found in the current directory and all of its sub-directories.
|
find . -print
|
Find all php files in current directory and delete text matching the regex '<?php /\*\*/ eval(base64_decode("aWY.*?>' in those files
|
find ./ -name "*.php" -type f | xargs sed -i 's#<?php /\*\*/ eval(base64_decode("aWY.*?>##g' 2>&1
|
Print appended data in "file" and search for "my_pattern" without buffering
|
tail -f file | stdbuf -o0 grep my_pattern
|
Find all directories containing 'linux' in their names under '/root' directory tree
|
find /root -type d -iname "*linux*"
|
find all text files in current folder and delete them
|
find . -name ".txt" -exec rm "{}" \;
|
Silently read $char number of symbols from file descriptor 4, without backslash escaping, and store received input in 'line' variable
|
read -u 4 -N $char -r -s line
|
find all the configuration or text files in current directory
|
find . -type f \ -print
|
Move all directories in the current directory tree that have been modified in the last day to "/path/to/target-dir"
|
find . -depth -type d -mtime 0 -exec mv -t /path/to/target-dir {} +
|
List all hidden regular files from the current directory separating them with zeroes
|
find . -maxdepth 1 -type f -name '.*' -printf '%f\0'
|
Search for utility "foo" in PATH, display its file type description.
|
file $
|
Find all *.m4a files/directories under /home/family/Music directory
|
find /home/family/Music -name *.m4a -print0
|
display all the directories in the current folder which are atleast one level deep
|
find . -mindepth 1 -type d -print0
|
Remove all *.txt files in the home directory tree with confirmation
|
find $HOME/. -name *.txt -ok rm {} \;
|
split file "$file into pieces named with 5 character suffix
|
split -a 5 $file
|
Sort lines in "FILE" to standard output preserving only unique lines
|
sort -u FILE
|
Shows strings that NOT match regex '^'
|
echo "${line}" | egrep --invert-match '^'
|
Print content of all files ending with '*.foo' in current directory recursively
|
find . -name '*.foo' -exec cat {} \;
|
Search the entire file system for .jpg files.
|
find / -name “*.jpg”
|
Save the list of files modified within a fortnight ago to `deploy.txt' stripping the file names of any leading directories
|
find . -type f -mtime -14 -printf '%f\n' > deploy.txt
|
Force create a symbolic link as a file named "/usr/lib/jvm/default-java" to "$default_java_dir" with verbose output
|
sudo ln -sTfv "$default_java_dir" "/usr/lib/jvm/default-java"
|
Move all *.log files under $sourcePath that were modified more than 10 days ago to a zip archive $zipFile
|
find $sourcePath -type f -mtime +10 -name "*.log" | xargs zip -mT $zipFile -@
|
search for all pdf files in the folder "/home/pdf" which have been accessed in the last 60*24 hours
|
find /home/you -iname "*.pdf" -atime -60 -type -f
|
Find all directories in directory tree `httpdocs'
|
find httpdocs -type d
|
remove all the "core" files in the current folder which have not been changed in the last 4 days.
|
find . -name core -ctime +4 -exec /bin/rm -f {} \;
|
find the count of all the charcters of the list of regular files present in the current folder
|
find . -type f | xargs | wc -c
|
Print lines in the sorted contents of "second.txt" that are not in the sorted contents of "first.txt"
|
comm -13 <(sort first.txt) <(sort second.txt)
|
Reports count of characters in the value of ${FOO} variable as follows: "length==<counted number of characters>"
|
echo -e "length==$"
|
Find all directories under /path/to/base/dir and change their permission to 755
|
find /path/to/base/dir -type d -exec chmod 755 {} +
|
display long listing of all the symbolic links in the current folder
|
find . -type l -exec ls -l {} \;
|
find all the text files in the home folder
|
find ~ -name "*.txt" — print
|
Find all files in your home directory and below that are smaller than 100M.
|
find ~ -size -100M
|
File 'mydatafile' has a number on each line, display the sum of these numbers rounded to lowest integer.
|
awk '{s+=$1} END {printf "%.0f", s}' mydatafile
|
Gets IP addresses of all active network interfaces on host.
|
ifconfig | awk -F':' '/inet addr/&&!/127.0.0.1/{split($2,_," ");print _[1]}'
|
Delete file with inode number 314167125
|
find . -type f -inum 314167125 -delete
|
Replace 'company' with 'newcompany' in all files under current directory and keep backups with .bakup extension
|
find -type f -print0 | xargs -0 sed -i .bakup 's/company/newcompany/g'
|
Delete all files/directories with node number $inum under current directory tree
|
find . -inum $inum -exec rm {} \
|
Unzip and untar "file.tar.gz"
|
zcat file.tar.gz |tar x
|
Find files in the current directory tree which are larger than 5 MB in size
|
find . -size +5000k -type f
|
Get a list of all hidden files from the current directory tree
|
find . -type f -name '.*' -print0 | while IFS= read -r -d '' f; do basename "$f"; done
|
Counts lines of /etc/fstab file.
|
cat /etc/fstab | wc -l
|
run command './bin/elasticsearch -d --default.path.conf=/etc/elasticsearch' as user elasticsearch
|
sudo su elasticsearch -c './bin/elasticsearch -d --default.path.conf=/etc/elasticsearch'
|
Find files in entire file system that are writable by group or other
|
find / -perm /g+w,o+w
|
search for the folder .dummy in the entire directory structure of "test folder" and remove it.
|
find -depth "Test Folder" -type d -name .dummy -exec rm -rf \{\} \;
|
Find all files/directories named 'articles.jpg' under current directory tree
|
find . -name "articles.jpg"
|
Search the current directory tree for regular files whose names begin with "orapw"
|
find . -name "orapw*" -type f
|
Find all top-level files in the current folder but ones with name like '*Music*' to the 'dest/' folder.
|
find . -maxdepth 1 -name '*Music*' -prune -o -print0 | xargs -0 -i cp {} dest/
|
Copies all files under the current folder like "file.ext" with "FooBar" in the path to the root of the current folder, preserving mode, ownership and timestamp attributes.
|
find . -name "file.ext"| grep "FooBar" | xargs -i cp -p "{}" .
|
Archive "/path/to/sfolder/" to "[email protected]:/path/to/remote/dfolder" preserving hard links and compressing the data during transmission
|
rsync -aHvz /path/to/sfolder/ [email protected]:/path/to/remote/dfolder
|
Recursively change the owner and group of "subdir2" to "user2"
|
chown user2:user2 -R subdir2
|
Prints sequentially listing of a current folder and calendar of a current month.
|
echo `ls` "`cal`"
|
show all the files in the current folder which has the word "ITM"
|
find . -name ‘*ITM*’
|
display all the ".c" files in the current folder excluding those that are present in the .svn sub folder
|
find . -name .svn -prune -o -name "*.c" -print
|
Print the list of files from the "/zu/durchsuchender/Ordner" directory tree whose names begin with "beispieldatei" and which contain string "Beispielinhalt"
|
find "/zu/durchsuchender/Ordner" -name "beispieldatei*" -print0 | xargs -0 grep -l "Beispielinhalt"
|
Search the specified group for the given "filename
|
find / -group users -iname "filename"
|
search for all the files having spaces in the current folder and save the output to the variable founddata
|
founddata=`find . -name "filename including space" -print0`
|
Find all files with the SUID bit set
|
find / -perm -u+s
|
display the filename and size of all the files in the file system which are bigger than 20MB
|
find / -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'
|
Create intermediate directories as required and directory /my/other/path/here
|
mkdir -p /my/other/path/here
|
Find '.git' directories in directory tree /path/to/files and print the pathnames of their parents
|
find /path/to/files -type d -name '.git' -exec dirname {} +
|
Find all regular files residing in the current directory tree and search them for string "/bin/ksh"
|
find . -type f -print | xargs grep -i 'bin/ksh'
|
Remount "/dev/block/mtdblock3" on "/system" with read and write permission
|
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
|
Archive all filepattern-*2009* files/directories under data/ into 2009.tar
|
find data/ -name "filepattern-*2009*" | cpio -ov --format=ustar > 2009.tar
|
Find all files ignoring hidden files under current directory and replace every occurrences of 'subdomainA.example.com' with 'subdomainB.example.com' in those files
|
find . -not -path '*/\.*' -type f -print0 | xargs -0 sed -i 's/subdomainA\.example\.com/subdomainB.example.com/g'
|
dispaly a long listig of all the files in the current folder which are bigger than 100KB
|
find . -size +100000 -ls
|
Get current directory name without full path, ie. the part after the last /
|
basename "$(pwd)"
|
find all the files that are modified in the last 7 days
|
find -daystart -mtime -7
|
Print every file's type, name, and inode
|
find -printf "%y %i %prn"
|
Find all files under /somefolder matching the extended regex '\./$' in their paths
|
find -E /somefolder -type f -regex '\./$'
|
Gets domain name from dig reverse lookup and save in variable 'go'.
|
go=$(dig -x 8.8.8.8| awk '/PTR[[:space:]]/{print $NF}')
|
Split "complete.out" into files with at most "$lines_per_file" lines each
|
split --lines $lines_per_file complete.out
|
Print "new.txt" with line numbers prepended and lines 3 and 4 deleted
|
cat new.txt | nl |sed "3d;4d"
|
Find all files under current directory and print only the filenames (not paths)
|
find . -type f -execdir echo '{}' ';'
|
Find all regular files in the home directory tree that were modified in the last 24 hours
|
find ~ -type f -mtime 0
|
Print the contents of "my_script.py"
|
cat my_script.py
|
find all the text files in current folder and change the extension of these files and move them to another folder
|
find ./ -name \*.txt | perl -p -e 's/^(.*\/\.txt)$/mv $1 .\/foo\/$2.bar.txt/' | bash
|
search for the file foo in the current folder and display a long listing of it in sorted order of modification date
|
find . -name foo | xargs ls -tl
|
find all the fles that have .ssh in the end and redirect the output to ssh-stuff
|
find / -name .ssh* -print | tee -a ssh-stuff
|
find all the normal/regular files in the current folder which are present in the pattern file "file_list.txt"
|
find . type f -print | fgrep -f file_list.txt
|
Locate logo.gif in the /var/www directory tree
|
find /var/www -name logo.gif
|
Show file type information for files in /usr/bin
|
find /usr/bin | xargs file
|
display the version of find command
|
find -version
|
List the current directory recursively ignoring ./src/emacs/ and all its contents
|
find . -path ./src/emacs -prune -o -print
|
Remove files that are greater than 1MB in size under current directory
|
find . -type f -size +1M -exec rm {} +
|
find regular files and directories that have been modified in the last seven days
|
find . -mtime -7 -type f
|
download contents from "https://www.npmjs.com/install.sh" and execute
|
curl https://www.npmjs.com/install.sh | sh
|
Delete all files with '.old' extension under current directory tree
|
find . -name “*.old” -exec rm {} \;
|
create directory dir
|
mkdir -p dir
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.