One-line wise

The best terminal one-liners from and for smart admins + devs.

Hosted and brought to you by SSD Nodes.

Search for a one-liner:

Choose a popular tag:

files loop network disk fun weird grep listing string bash utility system
mkdir FOLDER && cd $_Copy

Create the folder FOLDER and enter it.

files

Permalink: #mandicoot

while sleep 1;do tput sc;tput cup 0 $(($(tput cols)-29));date;tput rc;done &Copy

Show the date/time on the top-right corner of the current terminal.

utility

Permalink: #waterfish

for i in *; do mv -if $i `echo $i | tr '[:upper:]' '[:lower:]'`; doneCopy

Rename all files in current directory to lowercase.

files

Permalink: #mineapig

wget --random-wait -r -p -e robots=off -U mozilla WEBSITE.COMCopy

Download an entire website with wget. This will download all assets, including images, so use with care.

network

Permalink: #firebat

telnet towel.blinkenlights.nlCopy

Watch Star Wars IV. In your terminal. In ASCII. You better believe it.

fun

Permalink: #raccoot

grep -ril "SEARCH" DIRCopy

Open all the files under the directory DIR and look for instances of the word STRING.

grep

Permalink: #tigeon

curl ifconfig.meCopy

Get your current external IP. You can also try curl icanhazip.com as an alternative if ifconfig.me doesn't work.

network

Permalink: #partricken

tail -f /absolute/path/to/my/log1.log /absolute/path/to/my/log2.logCopy

Monitor the last lines of the specified log (or other) files.

utility

Permalink: #giantula

cp FILE{,.bak}Copy

Quickly make a .bak backup of a single file named FILE.

files

Permalink: #albat

apropos . | shuf -n 1 | awk '{print$1}' | xargs manCopy

Open a random man page.

weird

Permalink: #narwig

echo $PATH | tr ':' '\n'Copy

Display your $PATH in a human-readable format.

utility

Permalink: #rodentipede

awk '/'$(date -d "1 hours ago" "+%d\/%b\/%Y:%H:%M")'/,/'$(date "+%d\/%b\/%Y:%H:%M")'/ { print $0 }' /var/log/httpd/access_logCopy

Show the last 60 minutes of Apache logs.

files

Permalink: #deerkat

echo "!!" > foo.shCopy

Create a script out of your previous command. Useful for saving your favorite one-liners!

utility

Permalink: #raverfish

ssh sshtron.zachlatta.comCopy

Play Tron with others!

fun

Permalink: #vulturtle

watch grep \"cpu MHz\" /proc/cpuinfoCopy

Monitor your real-time CPU usage. Press Ctrl+C to exit.

system

Permalink: #primatee

history | awk '{a[$4]++}END{for(i in a){print a[i] " " i}}' | sort -rn | headCopy

Show your 10 most-used terminal commands.

utility

Permalink: #hermonkey

rm !(*.foo|*.bar|*.baz)Copy

Delete all the files in a folder that don't end in one of the extensions supplied.

files

Permalink: #blackadee

ls -l | awk '/^\-/ { print $5,$9 }' | sort -nr | awk '{print $2}'Copy

Display all files in the current directory, sorted by size, from largest to smallest. Use sort -n for smallest to largest.

listing

Permalink: #beaverine

echo "STRING" | revCopy

Reverse the letters of any STRING. STRING becomes GNIRTS.

string

Permalink: #swalrush

curl wttr.inCopy

Check the weather from your terminal.

utility

Permalink: #bobcatfish

install -b -m 777 /dev/null FILECopy

Create a new file FILE with permissions 777. The -b argument will make a backup of the file if it already exists.

files

Permalink: #vamprey

sudo !!Copy

Where it all began. Re-run the previous command, but as sudo.

bash

Permalink: #bobcatshark

This is the permalink to this one-liner. You can bookmark this link or copy it to share.

How to use One-line wise

Any time you see code that looks like this (bold red with a red underline), it's a signal that you need to replace that text with something else. We try to specify what that text should be in the one-liner's description.

What's next?

We're currently working on additional features—here are a few:

  • Many, many more one-liners!
  • Permalinks to one-liners
  • A primitive voting system (longshot)

Why build this tool?

What do you know—we wrote a blog post about this exact topic over on our blog, Serverwise. Mostly, we’re all about helping people learn and get more from their VPS.

Send us a one-liner

We're open to new one-liners and fixes/suggestions to existing ones! We want this to be a fun, evolving, and useful resource for developers and sysadmins of all skill levels.

You can contribute in two ways. First, you can send an email to [email protected].

Be sure to include the following:

  • The one-liner
  • A description of what the one-liner does, and how it works, if necessary.
  • The most appropriate existing tag (or recommend a new one)
  • Whether you'd like to be credited, and how: website, Twitter, email, etc

You can also contribute via GitHub.

You can create a new issue or a pull request for fixes, improvements, and additional one-liners.

About this tool

This was built by the people behind SSD Nodes as a way to share our server wisdom and test out the Tailwind CSS framework and its "utility-first" methodology and explore whether it's a viable development process for us.

View One-line wise on GitHub.

We hope you enjoy!

Last updated: November 19, 2018

Star Issue

Sign up for our weekly newsletter to hear about One-line wise developments and other server wisdom: