All commands (13,398)

  • wget && tar -xzf 1.15.3.tar.gz && cd nginx-1.15.3 Show Sample Output

    ./configure --help | grep -P "^ +--with-(?!(poll|select))[^=]+(_module( |$)| (module|support)$)" | sed -r 's/((dis|en)able|build) /# /'
    emphazer · 2018-09-14 12:54:06 2
  • opposite of ;-) Show Sample Output

    function URLEncode { local dataLength="${#1}"; local index; for ((index = 0;index < dataLength;index++)); do local char="${1:index:1}"; case $char in [a-zA-Z0-9.~_-]) printf "$char"; ;; *) printf "%%%02X" "'$char"; ;; esac; done; }
    emphazer · 2018-09-14 12:08:10 1
  • Unlock your VMS to avoid problems after some failed tasks ended. Show Sample Output

    for i in $(qm list | awk '{ print $1 }' | grep -v VMID); do echo "Unlocking:" $i; qm unlock $i; echo "Unlocked"; done
    arkalira · 2018-09-13 08:35:12 1

  • 1
    rpm -qa --last | head -n 16
    sparsile · 2018-09-13 02:55:51 1
  • Display a list of the 16 most recently installed RPM packages with newest first. Show Sample Output

    rpm -qa --queryformat '%{INSTALLTIME} %{name}-%{version}-%{release}\n' | sort -k 1,1 -rn | nl | head -16 | awk '{printf("%3d %s %s\n", $1,strftime("%c",$2),$3)}'
    mpb · 2018-09-12 17:47:26 2

  • 1
    tcpdump -nnvvXSs 1514 -i <device> <filters>
    25killer · 2018-09-09 10:37:19 1

  • 1
    comm -12 <(sort -u File1) <(sort -u File2)
    guillaume1306 · 2018-09-07 11:36:15 1
  • If you want to code without a IDE, using java may be painful to discover correct full class names to import. This script google it with javadoc word, then with some luck we got the javadoc as first item. next it curl the target javadoc and extract full name from it. Can by customized to extract other javadoc infos. Pre-reqs: bash, google-chrome, html2text and core-utils Show Sample Output

    getJavaFullClassName SpringComponent
    glaudiston · 2018-09-06 18:22:02 1
  • sleep in microseconds instead of seconds Alternatively to usleep, which is not defined in POSIX 2008 (though it was defined up to POSIX 2004, and it is evidently available on Linux and other platforms with a history of POSIX compliance), the POSIX 2008 standard defines nanosleep Show Sample Output

    time usleep 100000
    emphazer · 2018-09-06 10:28:26 1
  • Binding a server to privileged port on Linux w/o running as root This is applicable to any service using privileged ports (< 1024), for instance to run a HTTP server on port 80 or a LDAP directory server on port 389 for example. Show Sample Output

    sudo setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/python2.7
    emphazer · 2018-09-04 17:30:47 1
  • Don't want to log out but you do want to get rid of a stored .zip file password in Windows? This will do that.

    FOR /f "tokens=2-3 delims==" %G IN ('cmdkey /list ^| find ".zip"') DO cmdkey /delete:"%G=%H"
    ayaksich · 2018-09-04 16:33:53 0

  • -1
    cal -n 2 8 2018
    actionless · 2018-09-04 13:31:03 0

  • 2
    pstree -plants $(pidof -s firefox)
    cbrchrt · 2018-09-04 12:22:57 1

  • 3
    cat databases.txt | while read db; do docker exec $container_name bash -c "mysqldump -uroot -p\$MYSQL_ROOT_PASSWORD ${db}" | gzip -9 > $HOME/backups/${db}_`date +%Y%m%d_%H%M%S`.sql.gz; done
    batandwa · 2018-09-02 15:23:32 1

  • 0
    mkdir -p src && chmod 777 src && docker run -v $(pwd)/src:/var/www/html wordpress:cli core download && chmod 755 src
    nabil_kadimi · 2018-09-01 18:06:42 1

    lynx -dump -nonumbers|grep '/USER/'|cut -d'/' -f1,2,3,4,5|uniq|xargs -L1 git clone
    wuziduzi · 2018-09-01 06:03:23 1
  • Good old bracket expansion :-) For large numbers of files, "rename" will spare you the for-loop, or the find/exec...

    mv {,prefix_}yourfile.txt
    joedhon · 2018-08-30 18:18:50 0
  • Find and Convert all libre office files to PDF without libreoffice GUI Show Sample Output

    find /home/foo/Documents/ -type f -iname "*.odt" -exec libreoffice --headless --convert-to pdf '{}' \;
    switch · 2018-08-29 21:44:26 1
  • Displays last month, current month, and next month side by side. Show Sample Output

    cal -3
    arglborps · 2018-08-28 20:37:33 0

  • -1
    cal -A 1 8 2018
    jscolaire · 2018-08-28 20:23:03 0
  • Here is another way to show the path, one directory per line. The command `tr` translates the colon into the new line, taking input from the $PATH variable Show Sample Output

    tr : \\n <<<$PATH
    haivu · 2018-08-28 20:01:04 0
  • The Linux's `cal` command is nice, but there are times when I need to see two months side by side and this command will do it. Show Sample Output

    paste <(cal 8 2018) <(cal 9 2018)
    haivu · 2018-08-28 19:54:05 0
  • Find recursively all files in ~/Notes with the extension '.md' and pipe that via xargs to rename command, which will replace every '.md' to '.txt' in this example (existing files will not be overwritten).

    find ~/Notes -type f -iname '*.md' -print0 | xargs -0 rename --no-overwrite .md .txt {}
    Sommerfalke · 2018-08-24 09:41:51 1
  • HDMI-1 is the interface in the example, which can be obtained just by typing xrandr and surfing through the output. There are a hell lot of configurations that can be done but I prefer auto because it works in most cases. Lifesaver Show Sample Output

    xrandr --output < interface-name > --auto
    praton · 2018-08-23 17:51:20 0
  • Pluralize a word, aka change from single to multiple; text formatting. echo hamburgler | pluralize Show Sample Output

    pluralize() { if [ -n "$1" ]; then echo ${1}s else while read line; do pluralize $line done fi }
    cryptology_codes · 2018-08-21 22:49:21 0
  •  1 2 3 >  Last ›

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

find the longest command in your history

ignore the .svn directory in filename completion
When browsing java source code (for example) it's really annoying having to type the first letter of the package when there is only one package in the subdir. man bash for more info about FIGNORE

shell function to make gnu info act like man.
For those who hate navigating info pages, a shell function which will dump the contents to stdout, then page it through less, thus acting like 'man'.

Which .service related this file?
I use this as an alias to get all .service files related a single installed file/conf (if it has services, of course). For rpm based systems ;)

Summarize the number of open TCP connections by state
Useful for checking the number and state of TCP connections.

revert a file with svn

tar copy
Just a copy of a big dir when you wan't things like ownership and date etc etc to be untouched. Note: Updated with the ideas from "mpb".

Continually monitor things
You can use this one-liner for a quick and dirty (more customizable) alternative to the watch command. The keys to making this work: everything exists in an infinite loop; the loop starts with a clear; the loop ends with a sleep. Enter whatever you'd like to keep an eye on in the middle.

Toggle between directories
switch to previous directory or toggle

Annotate tail -f with timestamps

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: