Commands using fg (1)

  • make, find and a lot of other programs can take a lot of time. And can do not. Supppose you write a long, complicated command and wonder if it will be done in 3 seconds or 20 minutes. Just add "R" (without quotes) suffix to it and you can do other things: zsh will inform you when you can see the results. You can replace zenity with other X Window dialogs program.


    1
    alias -g R=' &; jobs | tail -1 | read A0 A1 A2 cmd; echo "running $cmd"; fg "$cmd"; zenity --info --text "$cmd done"; unset A0 A1 A2 cmd'
    pipeliner · 2010-12-13 17:44:36 2

What's this?

commandlinefu.com 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

test moduli file generated for openssh
this command test the moduli file generated by the command ssh-keygen -G /tmp/moduli-2048.candidates -b 2048 . The test can be long depend of your cpu power , around 5 minutes to 30 minutes

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"

List the most recent dates in reverse-chronological order
bash brace expansion, sequence expression

Print a list of installed Perl modules
This version works on an AIX system on which I have very limited permissions. The other version fails with "Can't open file /usr/opt/perl588/lib/site_perl/5.8.8/aix/auto/DBI/.packlist".

Run a command if today is the last day of the month
This is handy to just shove into a daily cron entry. If you do use cron, make sure to escape the %d with \%d or it will fail.

ignore hidden directory in bash completion (e.g. .svn)

Turn On/Off Keyboard LEDs via commandline
Usefull as a light blink to remember events, mails, intrusions, etc... yet another output Since nobody ever uses the scroll lock function... Usefull to interface a linux system with some hardware, for example, opto interfacing the keyboard led to a relay to remotely reset, etc. ( a simple LDR glued over the LED will do the trick ) xset led 3 turns on the third led, ie, Scroll lock xset -led 3 turns it off xset led 1 turns on Numerical Lock led ( doesn t work on all computer ) xset led 2 turns on Caps Lock led ( idem ) Using it as a reset watchdog, the relay expected light pulses. Shall the computer hangs, the relay releases and reset the machine ( discharge of a capacitor ) ;-)

Geolocate a given IP address

VIM: Go back to the last place you were in a document
You're perhaps editing a line, or reading a certain line of code, you use page up and down or move through the file and now you wish to return to the last position the cursor was at. '' will get you there.

Jump to a directory, execute a command and jump back to current dir


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.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

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: