Commands by Quintene2 (0)

  • bash: commands not found

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

Which processes are listening on a specific port (e.g. port 80)
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"

create iso image from a directory
create iso image from directory . Usefull for virtualised machine To create CD ISO image of directories that contain long file name or non-8.3 format (particularly if you want to burn the CD image for use in Windows system), use the -J option switch that generates Joliet directory records in addition to regular iso9660 file names. For example, to create CD image of Vista SP1 directory: mkisofs -o VitaSP1.iso -J VistaSP1

Monitor a file with tail with timestamps added
Should be a bit more portable since echo -e/n and date's -Ins are not.

List the largest directories & subdirectoties in the current directory sorted from largest to smallest.

Find default gateway

take a look to command before action
add |sh when you agree the list, I often use that method to prevent typos in dangerous or long operations

See loaded modules in apache
Easiest way to check which modules are loaded in apache.

Perl Simple Webserver
First we accept a socket and fork the server. Then we overload the new socket as a code ref. This code ref takes one argument, another code ref, which is used as a callback. The callback is called once for every line read on the socket. The line is put into $_ and the socket itself is passed in to the callback. Our callback is scanning the line in $_ for an HTTP GET request. If one is found it parses the file name into $1. Then we use $1 to create an new IO::All file object... with a twist. If the file is executable("-x"), then we create a piped command as our IO::All object. This somewhat approximates CGI support. Whatever the resulting object is, we direct the contents back at our socket which is in $_[0].

Bash logger

Save your open windows to a file so they can be opened after you restart
This will save your open windows to a file (~/.windows). To start those applications: $ cat ~/.windows | while read line; do $line &; done Should work on any EWMH/NetWM compatible X Window Manager. If you use DWM or another Window Manager not using EWMH or NetWM try this: $ xwininfo -root -children | grep '^ ' | grep -v children | grep -v '' | sed -n 's/^ *\(0x[0-9a-f]*\) .*/\1/p' | uniq | while read line; do xprop -id $line _NET_WM_PID | sed -n 's/.* = \([0-9]*\)$/\1/p'; done | uniq -u | grep -v '^$' | while read line; do ps -o cmd= $line; done > ~/.windows

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: