nl
stringlengths
13
387
bash
stringlengths
1
532
Show the last 10 .conf files found by `find' in the /etc directory
find /etc -maxdepth 1 -name "*.conf" | tail
Show the last 10 .conf files found by `find' in the /etc directory and 1 level below
find /etc -maxdepth 2 -name "*.conf" | tail
show the list of all the files in the current folder which have been modified within the 24 hours
find . -mtime 0 -print
Show the list of files larger than 100 MB
find / -size +100M -print
Show the list of files modified less than a minute ago
find / -mmin -1 -print
Show the list of files modified more than 31 days ago
find / -mtime +31 -print
Show the list of files that are not owned by user wnj or are not newer than file `ttt'
find / \! \( -newer ttt -user wnj \) -print
Show the list of files that are owned by user wnj or are newer than file `ttt'
find / \( -newer ttt -or -user wnj \) -print
Show the list of user wnj's files that are newer than file `ttt'
find / -newer ttt -user wnj -print
Show logged in users with idle time of each one
w | tr -s " " | cut -d" " -f1,5 | tail -n+3
Show long listing of current directory by deleting all digits from the output
ls -lt | tr -d 0-9
Show ls's detailed output for all files named "something"
find . -name something -exec ls -l {} \;
Shows MAC address of network interface eth0.
ifconfig eth0 | grep HWaddr |cut -dH -f2|cut -d\ -f2
Show manual for the find command
man find
Show manual of the find command
man find
Show manual of the find utility
man find
Show manual page for the find utility
man find
Show manual page of find
man find
Show the number of lines for each .php and .phtml file in the current directory tree
find . -type f \( -name "*.php" -o -name "*.phtml" \) -exec wc -l {} +;
Show the number of regular files in the current directory tree
find . -type f | wc -l
Shows only process trees rooted at processes of this user.
pstree user
Show process tree with command-line arguments of a process that has id 20238.
pstree -a -p 20238
Shows size of compressed file in .bz2 archive.
bunzip2 -c bigFile.bz2 | wc -c
Shows state of 'extglob' shell option.
shopt -o extglob
Shows state of 'globstar' shell option.
shopt globstar
Shows state of shell option 'extglob'.
shopt extglob
Shows status of a shell option 'compat31'.
shopt compat31
Shows status of a shell option 'dotglob'.
shopt dotglob
Shows status of a shell option 'nullglob'.
shopt nullglob
Shows strings that NOT match regex '^($|\s*#|\s*[[:alnum:]_]+=)'
echo "${line}" | egrep --invert-match '^($|\s*#|\s*[[:alnum:]_]+=)'
Show the subdirectories of the current directory
find . -maxdepth 1 -type d -print | xargs -I {} echo Directory: {}
Show the subdirectories of the current directory
find . -maxdepth 1 -type d -print | xargs echo Directories:
Show system information: kernel name, hostname, kernel release and version, machine architecture, processor type, hardware platform, and operating system type.
uname -a
Show the value of variable "list", discarding consecutive duplicates and adding number of occurrences at the beginning of each line.
echo "$list" | uniq -c
Show version information of the find utility
find -version
Show what content owned by root has been modified within the last day
find /etc/ -user root -mtime 1
Show who is logged on
who
Silently and recursively change the ownership of all files in the current directory to "www-data"
sudo chown -Rf www-data *
Silently read a line from standard input into variable "REPLY" without backslash escapes and using the prompt $'Press enter to continue...\n'
read -rsp $'Press enter to continue...\n'
Silently read a line into variable "passwd" with prompt "Enter your password: "
read -s -p "Enter your password: " passwd
Silently read a single character from standard input into variable "key" without backslash escapes and using the prompt $'Press any key to continue...\n'
read -rsp $'Press any key to continue...\n' -n 1 key
Silently read exactly 1 character ignoring any delimiters into variable "SELECT"
read -s -N 1 SELECT
Silently read standard input until the escape key is pressed ignoring backslash escapes and using the prompt $'Press escape to continue...\n'
read -rsp $'Press escape to continue...\n' -d $'\e'
simulate a full login of user root
su -
sleep for 1 second
sleep 1
sleep for 10 seconds
sleep 10
sleep for 5 seconds
sleep 5
sleep for 500 seconds
sleep 500
Sort "$file" and output the result to "$file"
sort -o $file $file
Sort "," delimited lines in "file" by the first field preserving only unique lines
sort -u -t, -k1,1 file
Sort ":" delimited lines in "test.txt" by the first and third field preserving only unique lines
sort -u -t : -k 1,1 -k 3,3 test.txt
Sort "file" using a buffer with a size 50% of main memory
sort -S 50% file
Sort "file1.txt" and output the result to "file1.txt"
sort -o file1.txt file1.txt
Sort "some_data" by the first and second ";" delimited entries and stabilizing the sort
sort -k1,1 -k2,2 -t';' --stable some_data
Sort "some_data" by the first and second ";" delimited entries, outputing unique lines and stabilizing the sort
sort -k1,1 -k2,2 -t';' --stable --unique some_data
Sort a file 'file' preserving only unique lines and change the file in-place
sort -u -o file !#$
Sort all directory names matching folder_* and go to the last one.
cd $(find . -maxdepth 1 -type d -name "folder_*" | sort -t_ -k2 -n -r | head -1)
Sort all directories under current directory placing the file with least modification time at first
find -type d -printf '%T+ %p\n' | sort
Sort and compare files "$def.out" and "$def-new.out"
diff <(sort $def.out) <(sort $def-new.out)
sort and display top 11 files along with the last access date for all the files in the file system ( sort based on the timestamp )
find / -type f -printf "\n%AD %AT %p" | head -n 11 | sort -k1.8n -k1.1nr -k1
sort and display the unique lines display the contents of all the files that have been modified in the last 91 days and not in the last 2 days
find . -name "*.txt" -type f -daystart -mtime -91 -mtime +2 | xargs cat | sort | uniq
Sort and print each unique line in "myfile.txt"
cat myfile.txt| sort| uniq
Sort and remove duplicate lines in the output of "finger"
finger | sort -u
sort based on size and display top ten largest normal/regular files in the current folder
find . -type f -exec ls -s {} \; | sort -n -r | head -10
sort based on size and display top ten small normal/regular files in the current folder
find . -type f -exec ls -s {} \; | sort -n | head -10
Sorts content of the $tmp file and filters out all strings with ':0'.
sort $tmp | grep -v ':0' #... handle as required
Sort the contents of file "ips.txt", eliminate duplicate entries, and prefix each entry with number of occurrences.
sort ips.txt | uniq -c
sort each file in the bills directory, leaving the output in that file name with .sorted appended
find bills -type f -execdir sort -o '{}.sorted' '{}' ';'
sort each file in the bills directory, leaving the output in that file name with .sorted appended
find bills -type f | xargs -I XX sort -o XX.sorted XX
Sort file "a.csv" by the first comma separated value of each line and print only unique entries
tac a.csv | sort -u -t, -r -k1,1 |tac
Sort file "file" by line
sort file -o !#^
Sort file "foo.txt" by line to standard output
sort foo.txt
Sort file pointed by variable $filename, removing duplicate entries but ignoring the last N characters of each line.
rev $filename | sort | uniq -f=N | rev
Sort file.txt ignoring the last 10 characters of each line.
sort file.txt | rev | uniq -f 10 | rev
Sort file1 and file2 then display differences between them.
diff <(sort file1 -u) <(sort file2 -u)
Sort lines in "FILE" to standard output preserving only unique lines
sort -u FILE
Sort lines in "set1" and "set2" to standard output preserving only unique lines
sort -u set1 set2
Sort the lines of the file 'inputfile', keep only the uniq lines and change it in-place
sort inputfile | uniq | sort -o inputfile
Sort the lines of the file 'temp.txt' and change it in-place
sort temp.txt -o temp.txt
Sort the lines of the file 'temp.txt' and change it in-place
sort temp.txt -otemp.txt
Sort numerically and compare files "ruby.test" and "sort.test"
diff <(sort -n ruby.test) <(sort -n sort.test)
Sort standard input in alphabetical order
sort
Sort strings of 'test.txt' file by second from the end field
rev test.txt | sort -k2 | rev
Sort tab separated file "file" using a version sort for field 6 and a numeric sort for field 7
sort -t$'\t' -k6V -k7n file
Split "$1" into files of at most "$2" or default 10000 using a numeric suffix of length 6
split -l ${2:-10000} -d -a 6 "$1"
Split "$1" into files of at most "$2" or default 10000 using a numeric suffix of length 6 and suffix "${tdir}/x"
split -l ${2:-10000} -d -a 6 "$1" "${tdir}/x"
Split "$FILENAME" into files with at most 20 lines each with a prefix "xyz"
split -l 20 $FILENAME xyz
Split "$INFILE" into files of at most "$SPLITLIMT" with a numeric suffix and a prefix "x_"
split -d -l $SPLITLIMT $INFILE x_
Split "$ORIGINAL_FILE" into files of at most "$MAX_LINES_PER_CHUNK" lines each with a prefix "$CHUNK_FILE_PREFIX"
split -l $MAX_LINES_PER_CHUNK $ORIGINAL_FILE $CHUNK_FILE_PREFIX
Split "$SOURCE_FILE" into files of at most 100 lines each
split -l 100 "$SOURCE_FILE"
Split "$file" into files with at most 1000 lines each and use a prefix length of 5
split -a 5 $file
Split "${fspec}" into 6 files with about equal number of lines each and use prefix "xyzzy."
split --number=l/6 ${fspec} xyzzy.
Split "/etc/gconf/schemas/gnome-terminal.schemas" into 1000000 files of about equal size
split -n 1000000 /etc/gconf/schemas/gnome-terminal.schemas
Split "/path/to/large/file" into files with at most 50000 lines and use prefix "/path/to/output/file/prefix"
split --lines=50000 /path/to/large/file /path/to/output/file/prefix
Split "/tmp/files" into files of at most 1000 lines each
split /tmp/files
Split "/usr/bin/cat" into 10000 files of about equal size
split -n 10000 /usr/bin/cat
Split "/usr/bin/firefox" into 1000 files of about equal size
split -n 1000 /usr/bin/firefox
Split "/usr/bin/gcc" into 100000 files of about equal size
split -n 100000 /usr/bin/gcc
Split "ADDRESSS_FILE" into files containing at most 20 lines and prefix "temp_file_"
split -l20 ADDRESSS_FILE temp_file_
Split "INPUT_FILE_NAME" into files of at most 500 MiB each with a numeric suffix of length 4 and prefix "input.part."
split -b 500M -d -a 4 INPUT_FILE_NAME input.part.