nl_command
stringlengths 14
387
| bash_code
stringlengths 0
532
|
---|---|
Split "/etc/gconf/schemas/gnome-terminal.schemas" into 1000000 files of about equal size
|
split -n 1000000 /etc/gconf/schemas/gnome-terminal.schemas
|
find the file "httpd.log" in the entire file system
|
find / -type f -name httpd.log
|
search files in the file system excluding those in the paths "10_Recommended" and "/export/repo"
|
find / -name whatever -not -path "/10_Recommended*" -not -path "/export/repo/*"
|
list all the files which have size 0 bytes in some directories
|
find `gen_root_dirs.sh` -type f -size 0 -ls
|
find all regular files in a folder using regular expressions which do not have a specific name pattern and send these files as input to the script.bash script file
|
find "$DIRECTORY_TO_PROCESS" -type f -iregex ".*\.$FILES_TO_PROCES" ! -name "$find_excludes" -print0 | xargs -0 -I {} bash script.bash {}
|
Find all *.html files under current directory and for each file replace the first occurrence of STRING and previous lines with the content of common_header file
|
find . -type f -name '*.html' -exec sed -i -e '1r common_header' -e '1,/STRING/d' {} \;
|
Decompress and extract '/usr/src/redhat/SOURCES/source-one.tar.gz'
|
gzip -dc /usr/src/redhat/SOURCES/source-one.tar.gz | tar -xvvf -
|
Store info about all mounted file systems, printing all sizes in powers of 1000
|
a=$
|
Find all Executable files in the file system
|
find / -perm /a=x
|
List all nfs mount points on the system
|
mount -l | grep 'type nfs' | sed 's/.* on \ .*/\1/'
|
display all the directories in the current folder for the files which have not been accessed in the last 48 hours
|
find . -type d -atime +2
|
Search the file system for regular files whose names are shorter than 25 characters
|
find / -type f -regextype posix-extended -regex '.*/.{1,24}$'
|
Print a sorted list of *.so files in the bla directory tree
|
find bla -name *.so -print0 | sort -rz
|
searches through the root filesystem ("/") for the file named Chapter1.
|
find / -name Chapter1 -type f -print
|
extract 'archive.tar.gz' to /destination
|
tar xzf archive.tar.gz -C /destination
|
display all the directories in the current folder
|
find . -type d
|
Recursively copy all regular files below current directory to directory /tmp on hostname, connecting as ssh user matching current username on local host.
|
find . -type f -exec scp {} hostname:/tmp/{} \;
|
Calculate md5 checksum of $line and save to variable 'md5'
|
md5=$(echo "$line"|md5sum)
|
show all .cpp, .c, .h, .hpp files in the folder ~/src
|
find ~/src -type f \ -exec echo {} \;
|
Change the group of "myfile" to "friends"
|
chown :friends myfile
|
Find all directories under current directory and replace all null delimiters with : in the output then remove the last :
|
find -type d -print0 | sed -e "y/\d0/:/;s/:$//;"
|
find all the files in the entire file system that start with top
|
find / -name 'top*'
|
search for all mp3 files in the folder /home/you which have been accessed exactly 10*24 hours ago
|
find /home/you -iname "*.mp3" -atime 10 -type -f
|
Print IP address of the current host
|
echo $(/usr/sbin/arp $ | awk -F'[]' '{print $2}')
|
Print sorted list of strings from 'ip_addresses' file, with number of occurrences of each string.
|
sort ip_addresses | uniq -c
|
find files in home directory that names are game
|
find ~ -name game
|
Rename "blah2" to "blah2-new"
|
mv blah2 blah2-new
|
Delete all hidden files under $some_directory
|
find "$some_directory" -type f -name '.*' -delete
|
Display "/tmp/file" as a table of width 30 with columns filled before rows
|
column -x -c 30 /tmp/file
|
Find all files larger than 20000k
|
find / -type f -size +20000k
|
Format "$line" as a table
|
echo "$line" | column -t
|
Recursively change owner and group to "$JBOSS_AS_USER" of "$JBOSS_AS_DIR"
|
chown -R $JBOSS_AS_USER:$JBOSS_AS_USER $JBOSS_AS_DIR
|
Find all directories under current directory
|
find -type d
|
Find all files/directories with user id 120 under current directory tree
|
find . -uid 120 -print
|
Remove all files whose names end with "~" in the /home/peter directory tree
|
find /home/peter -name *~ |xargs rm
|
Search regular files from the /path/to/dir directory tree for lines that contain "_START" and are enclosed in lines "@GROUP" and "@END_GROUP"
|
find /path/to/dir -type f -exec sed '/@GROUP/,/@END_GROUP/!d' {} + | grep '_START'
|
Take first text field from file 'file.txt' as a domain name and get short A record for this one.
|
cut -d' ' -f1 file.txt | xargs dig +short
|
Find all "G*.html" files modified more than 7 days ago in the current directory tree
|
find . -mtime +7 -name "G*.html"
|
Print lines in the sorted contents of "a.txt" that are not in the sorted contents of "b.txt"
|
comm -23 <(sort a.txt) <(sort b.txt)
|
Read a line from standard input with prompt "Continue ?" and save response in variable "choice"
|
read -p "Continue ?" choice
|
Find all files/directores that are newer than /etc/motd and conain the string 'top' at the beginning of their names under user's home directory tree
|
find ~ -name 'top*' -newer /etc/motd
|
display list of all the C files ( fuiles with ".c" extension ) in current folder
|
find . -name '*.c' -ls
|
find all regular files in current folder which are atleast 1 level deep and search in the alphabetical order of the directory names
|
find -s . -mindepth 1 -type f -print0; printf '\0';
|
Format time string @1267619929 according to default time format
|
date -d @1267619929
|
SSH in server 'server' as user 'user' with X11 forwarding disabled
|
ssh -x user@server
|
Find the "erl" executable in $PATH and read the "RELEASES" file to extract the erlang release number
|
awk -F, 'NR==1 {gsub;print $3}' "$(dirname $(readlink -f $))/../releases/RELEASES"
|
Find users whose names begin with "ab" and ends with "1"
|
who | cut -d ' ' -f 1 | grep -e '^ab' -e '1$'
|
Recursively change the owner and group of all files in the current directory to "andrewr"
|
chown -R andrewr:andrewr *
|
Find all files in the current directory tree, except GIT files
|
find -type f -name .git -prune -o -print
|
Compare sorted files 'f1.txt' and 'f2.txt' and print in three columns strings unique for first file, second file, and common ones
|
comm <(sort f1.txt) <(sort f2.txt)
|
Search the current directory tree for PHP files changed less than 14 days ago
|
find . -name *.php -ctime -14
|
change the permissions of mp3 files in the folder /var/ftp/mp3 to 644
|
find /var/ftp/mp3 -name '*.mp3' -type f -exec chmod 644 {} \;
|
List the last modified file under "$DIR"
|
find $DIR -type f -printf "%T@ %p\n" | sort -n | cut -d' ' -f 2 | tail -n 1
|
Calculate md5 sums for each files matching 'main.cpp*'
|
md5sum main.cpp*
|
Recursively change the owner and group of "/opt/antoniod/" to "antoniod"
|
chown -R antoniod:antoniod /opt/antoniod/
|
display all the files in the current folder.
|
find .
|
Find all files under /home/username/public_html/modules and set their permission to 640
|
find /home/username/public_html/modules -type f -exec chmod 640 {} +
|
find all the files in the current folder which have executable permission to all the users and display the ten files
|
find . -perm /a=x | head
|
Remove the "^M" characters from all *.ext files under /home directory
|
find /home -type f -name "*.ext" -exec perl -pi -e 's/\r//g' {} \;
|
display long listing of all regular/normal files whose size is less than 50 bytes.
|
find /usr/bin -type f -size -50c -exec ls -l '{}' ';'
|
Prints dates of $m month in $y year, preceded by month number and slash like ' 10/1'.
|
cal $m $y | sed -e '1,2d' -e 's/^/ /' -e "s/ \([0-9]\)/ $m\/\1/g"
|
Grab the output of "basename" and echo it to stdout, which basename would do by default anyway.
|
echo `basename "$filename"`
|
list names of bind functions containing "/"
|
bind -l | grep /
|
search all the files in the current folder using regex
|
find . -regex ".*/my.*p.$"
|
find all the png files in the current folder which are present in the pattern list search .txt
|
find . -name '*.png' | grep -f search.txt
|
Recursively finds all files and prints all strings with 'text-to-find-here' from that files.
|
find / -type f | xargs grep 'text-to-find-here'
|
Run 'git pull' in every git repository in the current directory
|
find . -type d -name .git -exec sh -c "cd \"{}\"/../ && pwd && git pull" \;
|
Copy file linked to by "file" to "file"
|
cp --remove-destination `readlink file` file
|
Find all php files that belong to user 'takuya' and have been modified in the last 1 day
|
find -user takuya -name '*.php' -daystart -mtime -1
|
list *.pdf files under the /home/user/Desktop directory.
|
find /home/user/Desktop -name '*.pdf'
|
Print the sorted unique column of usernames of users who are currently logged in without the header
|
finger | tail -n +2 | awk '{ print $1 }' | sort | uniq
|
Find all files that have additional permissions
|
find / -perm -644
|
Dump the character output of 'echo `echo "Ho ho ho"`'
|
echo `echo "Ho ho ho"` | od -c
|
View line 500 to line 500 + 501 in gzipped file "bigfile.z"
|
zcat bigfile.z | tail -n +500 | head -501
|
Change owner to "$1" and group to "httpd" of ".htaccess"
|
chown $1:httpd .htaccess
|
Delete all .svn files/directories under current directory
|
find . -name .svn -exec rm -rf {} \;
|
Print unique lines of sorted "File 1" compared with sorted "File 2"
|
comm -23 "File 1" "File 2"
|
Look for files with wide open permissions
|
find . -type f -perm a=rwx -exec ls -l {} \;
|
Find all *.* files not within .git directory and run $SED_CMD -i "s/$1/$2/g" on each of them
|
find . -type f -name "*.*" -not -path "*/.git/*" -print0 | xargs -0 $SED_CMD -i "s/$1/$2/g"
|
change the ownership of all regular/normal files in the current directory after users confirmation
|
find . -type f -ok chown username {} \;
|
Print relative path of device of disk with UUID "b928a862-6b3c-45a8-82fe-8f1db2863be3"
|
readlink /dev/disk/by-uuid/b928a862-6b3c-45a8-82fe-8f1db2863be3
|
Search case insensitively for 'foo' in all the files with '.java' extension under current directory tree and show only the file names
|
find . -type f -name "*.java" -exec grep -il 'foo' {} \;
|
Count all the lines of code in all php files in current directory recursively
|
find . -name "*.php" | xargs grep -v -c '^$' | awk 'BEGIN {FS=":"} { $cnt = $cnt + $2} END {print $cnt}'
|
change owner of the file file.sh to user root
|
$sudo chown root file.sh
|
Move all hidden files in "wordpress" to the current directory
|
mv wordpress/.* .
|
Print list of file systems currently mounted.
|
df -h | awk '{print $1}'
|
Read a line from standard input and save each word in the bash array variable "first"
|
read -a first
|
Print file information of command "bash"
|
echo $(ls -l $(which bash))
|
Make directory "/tmp/googleTestMock"
|
mkdir /tmp/googleTestMock
|
Find all regular files with '.what_to_find' extension in the entire filesystem and move them to directory '/new_directory'
|
find / -iname "*.what_to_find" -type f -exec mv {} /new_directory \;
|
Find all files under minimum 1 level down the current directory
|
find . -mindepth 1 -type f
|
Number each non-blank line of standard input
|
nl
|
Find all *.c files under and below the current directory that contain "wait_event_interruptible"
|
find . -name \*.c -print | xargs grep wait_event_interruptible /dev/null
|
Set the setgid bit on all directories in the repository "/git/our_repos"
|
find /git/our_repos -type d -exec chmod g+s {} +
|
Set prompt to the system host name and history number
|
PS1="`hostname`:\!>"
|
Search core files in current direcory and delete .
|
find . -name core -exec rm {} \;
|
Split "biglogfile.gz" into chunks of 500000 line gzipped compressed files
|
zcat biglogfile.gz | split -l500000 --filter='gzip > $FILE.gz'
|
Find all *.rb and *.py files/directories under current directory
|
find . -name "*.rb" -or -name "*.py"
|
Change permissions to 755 for all directories in the current directory tree
|
find . -type d | xargs chmod -v 755
|
Copy directory tree preserving UID and GID and leaving user files alone
|
find . -depth -print | cpio -o -O /target/directory
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.