Commands by thhhhheesi (2)

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

Use /dev/full to test language I/O-failsafety
The Linux /dev/full file simulates a "disk full" condition, and can be used to verify how a program handles this situation. In particular, several programming language implementations do not print error diagnostics (nor exit with error status) when I/O errors like this occur, unless the programmer has taken additional steps. That is, simple code in these languages does not fail safely. In addition to Perl, C, C++, Tcl, and Lua (for some functions) also appear not to fail safely.

Use tee + process substitution to split STDOUT to multiple commands
Using process substitution, we can 'trick' tee into sending a command's STDOUT to an arbitrary number of commands. The last command (command4) in this example will get its input from the pipe.

Sort processes by CPU Usage
Short list about top 10 processes, sorted by CPU usage

Display which user run process from given port name
Display which user run process from given port name

Scroll up (or Down (PgDn)) in any terminal session (except KDE)

Using NMAP to check if a port is open or close
Using NMAP to check to see if port 22(SSH) is open on servers and network devices.

Email yourself a short note
I created this so I could send myself an email alert when a long-running job was finished, e.g., $ my_long_job.exe ; quickemail my_long_job.exe has finished

After typing lots of commands in windows, save them to a batch file quickly
After typing the command below, you will be greeted with nothing. press the up arrow to find the previous command you typed, press enter. repeat this as many times as you need, then hit CTRL-Z and press enter to save to the 'batchfilename.bat' file.

Perl One Liner to Generate a Random IP Address

return external ip
I dont have curl or links installed, so I use wget with write file as standard out.

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: