nl
stringlengths
13
387
bash
stringlengths
1
532
Print symlink resolved script file name
echo $(basename $(readlink -nf $0))
Print the time of last boot
who -b
print top 10 largest files and directories
du -a . | sort -nr | head
Prints top-ten biggest top-level folders within a 'var' folder.
sudo du -hDaxd1 /var | sort -h | tail -n10
Prints total number of lines of all *.php files in a current folder and subfolders.
cat `find . -name "*.php"` | wc -l
Print TXT record with server`s hostname from nameserver 'server'
dig @server hostname.bind ch txt
Print the type of the current shell
echo $(cat /proc/$$/cmdline)
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-
Print unique lines in "file1" compared to "file2" in the order they appear
comm -23 <(sort file1) <(sort file2)|grep -f - file1
Print unique lines in "file_a" and "file_b"
sort file_a file_b|uniq -u
Print unique lines in sorted "file1" compared to sorted file "file2"
comm -23 file1 file2
Print unique lines in sorted file "a.txt" compared to sorted file "b.txt"
comm -23 a.txt b.txt
Print unique lines of "a" and "b"
comm -3 a b
Print unique lines of "second-file-sorted.txt" compared to "first-file-sorted.txt"
comm -23 second-file-sorted.txt first-file-sorted.txt
Print unique lines of sorted file "a" compared with sorted file "b"
comm -23 a b
Print unique lines of sorted file "b" compared with sorted file "a"
comm -13 a b
Print unique lines of sorted file "f1" compared to sorted file "f2"
comm -2 -3 f1 f2
Print unique lines of sorted file "file1" when compared with the list of first space separated fields of all sorted strings of file "file2"
cut -d' ' -f1 file2 | comm -13 - file1
Print unique lines of sorted file "second.txt" compared to sorted file "first.txt"
comm -13 first.txt second.txt
Print unique list of who is logged in and the time of login formatted in columns
who -su | sort | uniq | column
Print variable "$OPTARG" "$opt" times
yes "$OPTARG" | head -$opt
Print variable "$module" in formatted columns with at most 80 characters per line
echo $modules | column -t | fold | column -t
Print variable "$opt" with double quotes deleted
echo "$opt" | tr -d '"'
Print what year it was 222 days ago
date '+%Y' --date='222 days ago'
Prints what year it was 222 days ago
date --date="222 days ago" +"%Y"
Print whether "$file" and "${file/${dir1}/${dir2}}" differ
diff -q "$file" "${file/${dir1}/${dir2}}"
Print whether the sorted contents of "set1" and "set2" differ
diff -q <(sort set1) <(sort set2)
Print whether the unique contents of "set1" and "set2" differ
diff -q <(sort set1 | uniq) <(sort set2 | uniq)
Print which files differ between "dir1/" and "dir2/"
diff --brief -r dir1/ dir2/
Print which files differ between "folder1" and "folder2" treating all files as text
diff -arq folder1 folder2
Print which files differ between dir1 and dir2, treating absent files as empty
diff --brief -Nr dir1/ dir2/
Print which files differ in "PATH1/" and "PATH2/" recursively excluding any files that match any pattern in "file1"
diff PATH1/ PATH2/ -rq -X file1
Print which files differ in "dir1" and "dir2" recursively
diff -qr dir1 dir2
Print which files differ in "dir1" and "dir2" recursively
diff -qr dir1/ dir2/
Print which files differ in "dir1" and "dir2" recursively
diff -rq dir1 dir2
Print which files differ in "folder1" and "folder2" excluding "node_modules" recursively, output in two columns, and paginate the output
diff -rqyl folder1 folder2 --exclude=node_modules
Prints year-month-date format for given time
date -d "yesterday 13:00" '+%Y-%m-%d'
Print yesterday's date
date -j -v-1d
Print yesterday's date as yyy:mm:dd
date +%Y:%m:%d -d "1 day ago"
Print yesterday's date as yyy:mm:dd
date +%Y:%m:%d -d "yesterday"
Prints yesterday's date information
date --date yesterday "+%a %d/%m/%Y"
Print yesterday's date information in "%a %d/%m/%Y" format
date -d "-1 days" +"%a %d/%m/%Y"
Print your/dir if it's an empty directory
find your/dir -prune -empty -type d
Processes all files recursively in /var/spool/cron/tabs folder and filters out all strings with '#'.
grep -v "#" -R /var/spool/cron/tabs
Prompt the user with a question "This is the question I want to ask?" and save "y" or "n" in variable "REPLY" in zsh
read REPLY\?"This is the question I want to ask?"
Put the absolute directory path to the current script to MY_DIR variable
MY_DIR=$(dirname $(readlink -f $0))
Query about which keys invoke the named function
bind -q complete
Query SRV records for domain '_kerberos._udp.foo.com'
dig -t SRV _kerberos._udp.foo.com
Read 10 bytes from $0 and print them by replacing the set '\000-\377' with '#'
head -c 10 "$0" | tr '\000-\377' '#'
Read a line from an interactive shell's standard input into variable "message" without backslash escapes and prompt $'Please Enter a Message:\n'
read -rep $'Please Enter a Message:\n' message
Read a line from standard input
read
Read a line from standard input and save each word in the bash array variable "first"
read -a first
Read a line from standard input and save received words sequentially in variables XPID XUSERID XPRIORITY XVIRTUAL XRESIDENT XSHARED XSTATE XCPU XMEM XTIME XCOMMAND
read XPID XUSERID XPRIORITY XVIRTUAL XRESIDENT XSHARED XSTATE XCPU XMEM XTIME XCOMMAND
Read a line from standard input and save response in variable "VARNAME"
read VARNAME
Read a line from standard input in an interactive shell into variable "input" with prompt "Do that? [Y,n]" and suggestion "Y"
read -e -p "Do that? [Y,n]" -i Y input
Read a line from standard input in an interactive shell with prompt in variable "myprompt" interpreted as PS1 is interpreted
read -e -p "${myprompt@P}"
Read a line from standard input into the first argument ("$1") using an interactive shell with prompt "> "
read -e -p '> ' $1
Read a line from standard input into variable "PASSWORD"
read PASSWORD
Read a line from standard input into variable "REPLY" with prompt "$1 ([y]es or [N]o): "
read -p "$1 ([y]es or [N]o): "
Read a line from standard input into variable "REPLY" with prompt "> $line (Press Enter to continue)"
read -p "> $line (Press Enter to continue)"
Read a line from standard input into variable "REPLY" with prompt "Press [Enter] key to release lock..."
read -p "Press [Enter] key to release lock..."
Read a line from standard input into variable "YESNO" ignoring backslash escapes and using the prompt "$(echo $@) ? [y/N] "
read -r -p "$(echo $@) ? [y/N] " YESNO
Read a line from standard input into variable "a" without backslash escapes
read -r a
Read a line from standard input into variable "date" with prompt "BGC enter something", and storing typed backslash as backslash symbol
read -p 'BGG enter something:' -r data
Read a line from standard input into variable "dir"
read dir
Read a line from standard input into variable "foobar" and suppress showing user input
read -s foobar
Read a line from standard input into variable "i" with the prompt " Again? Y/n "
read -p " Again? Y/n " i
Read a line from standard input into variable "message" with escaped prompt "\nPlease Enter\na Message: '"
read -p "`echo -e '\nPlease Enter\na Message: '`" message
Read a line from standard input into variable "message" with prompt "Please Enter a Message: " followed by a newline
read -p "Please Enter a Message: `echo $'\n> '`" message
Read a line from standard input into variable "message" with prompt "Please Enter a Message: " followed by a newline
read -p "`echo -e 'Please Enter a Message: \n\b'`" message
Read a line from standard input into variable "password" without echoing the input
read -s password
Read a line from standard input into variable "password" without echoing the input and using the prompt "Password: "
read -s -p "Password: " password
Read a line from standard input into variable "prompt" with the prompt "Are you sure you want to continue? <y/N> "
read -p "Are you sure you want to continue? <y/N> " prompt
Read a line from standard input into variable "response" ignoring backslash escapes and using the prompt "${1:-Are you sure? [y/N]} "
read -r -p "${1:-Are you sure? [y/N]} " response
Read a line from standard input into variable "response" ignoring backslash escapes and using the prompt "Are you sure? [y/N] "
read -r -p "Are you sure? [y/N] " response
Read a line from standard input into variable "response" without backslash escapes using the prompt "About to delete all items from history that match \"$param\". Are you sure? [y/N] "
read -r -p "About to delete all items from history that match \"$param\". Are you sure? [y/N] " response
Read a line from standard input into variable "text" with the prompt " Enter Here: "
read -p " Enter Here : " text
Read a line from standard input into the variable "yn" using the first argument as the prompt ("$1 ")
read -p "$1 " yn
Read a line from standard input into the variable "yn" with the prompt "Do you wish to install this program?"
read -p "Do you wish to install this program?" yn
Read a line from standard input with a timeout of 0.1 seconds and prompt "This will be sent to stderr"
read -t 0.1 -p "This will be sent to stderr"
Read a line from standard input with a timeout of 10 seconds
read -t 10
Read a line from standard input with prompt "<Your Friendly Message here> : y/n/cancel" and save the response to variable "CONDITION"
read -p "<Your Friendly Message here> : y/n/cancel" CONDITION;
Read a line from standard input with prompt "Are you alright? (y/n) " and save the response to variable "RESP"
read -p "Are you alright? (y/n) " RESP
Read a line from standard input with prompt "Are you sure you wish to continue?"
read -p "Are you sure you wish to continue?"
Read a line from standard input with prompt "Are you sure? [Y/n]" and save response in variable "response"
read -r -p "Are you sure? [Y/n]" response
Read a line from standard input with prompt "Continue (y/n)?" and save response in variable "CONT"
read -p "Continue (y/n)?" CONT
Read a line from standard input with prompt "Continue (y/n)?" and save response in variable "choice"
read -p "Continue (y/n)?" choice
Read a line from standard input with prompt "Enter your choice: " and save response to variable "choice"
read -p "Enter your choice: " choice
Read a line from standard input with prompt "Enter your choice: ", arrow keys enabled, and "yes" as the default input, and save the response to variable "choice"
read -e -i "yes" -p "Enter your choice: " choice
Read a line from standard input with prompt "Is this a good question (y/n)? " and save the response to variable "answer"
read -p "Is this a good question (y/n)? " answer
Read a line of standard input in an interactive shell
read -e
Read a line of standard input into variable "_command" with the prompt as the current working directory followed by "$"
read -p "`pwd -P`\$ " _command
Read a line of standard input into variable "input_cmd" with prompt "command : "
read -p "command : " input_cmd
Read a line of standard input with prompt "Enter your choice: " in an interactive shell and save the response to variable "choice"
read -e -p "Enter your choice: " choice
Read a single character from standard input and do not allow backslash to escape characters
read -rn1
Read a single character from standard input into variable "REPLY" ignoring backslash escapes and using the prompt "${1:-Continue?} [y/n]: "
read -r -n 1 -p "${1:-Continue?} [y/n]: " REPLY
Read a single character from standard input into variable "ans"
read -n1 ans
Read a single character from standard input into variable "doit" with prompt "Do that? [y,n]"
read -n1 -p "Do that? [y,n]" doit
Read a single character from standard input into variable "key" without backslash escapes and using an interactive shell with the prompt $'Are you sure (Y/n) : ' and default value $'Y'
read -rp $'Are you sure (Y/n) : ' -ei $'Y' key
Read a single character from standard input into variable "key" without backslash escapes and using the prompt "Press any key to continue..."
read -n1 -r -p "Press any key to continue..." key