Commands by ludwig (1)

  • Another step to bring cli and gui closer together: gnome-open It opens a path with the default (gui) application for its mime type. I would recommend a shorter alias like alias o=gnome-open More examples: gnome-open . [opens the current folder in nautilus / your default file browser] gnome-open some.pdf [opens some.pdf in evince / your default pdf viewer] gnome-open trash:// [opens the trash with nautilus] gnome-open http://www.commandlinefu.com [opens commandlinefu in your default webbrowser] Show Sample Output


    2
    gnome-open [path]
    ludwig · 2010-06-30 07:20:05 0

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

List files by quoting or escaping special characters.
Tested and works on Linux.

list block devices
Shows all block devices in a tree with descruptions of what they are.

Find out which process uses an old lib and needs a restart after a system update
Shows the full output of lsof.

processes per user counter
use Linux ;)

Console clock -- within screen
Configures screen to always display the clock in the last line (has to be configured only once). After that you not only have got the possibility to detach sessions and run them in background, but also have got a nice clock permanently on your screen.

Show a passive popup in KDE
Display a passive popup during seconds. Additionnaly, --title can be used to set the title of the popup. This is a nice way to communicate with a desktop user of a machine you have an SSH access on : DISPLAY=:0 sudo -u $user -H kdialog --passivepopup "Hello you" 10 --title "cli IM"

Quickly create an alias for changing into the current directory
Put the function in your .bashrc and use "map [alias]" to create the alias you want. Just be careful to not override an existing alias.

Get the Nth argument of the last command (handling spaces correctly)
Bash's history expansion character, "!", has many features, including "!:" for choosing a specific argument (or range of arguments) from the history. The gist is any number after !: is the number of the argument you want, with !:1 being the first argument and !:0 being the command. See the sample output for a few examples. For full details search for "^HISTORY EXPANSION" in the bash(1) man page.    Note that this version improves on the previous function in that it handles arguments that include whitespace correctly.

Update all ant packages installed in gentoo
Update all "ant" packages installed on Gentoo

Write comments to your history.
A null operation with the name 'comment', allowing comments to be written to HISTFILE. Prepending '#' to a command will *not* write the command to the history file, although it will be available for the current session, thus '#' is not useful for keeping track of comments past the current session.


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: