Commands by conan (2)

  • You know there 'cd -' to go to the previous directory you were standing before, but it will no record more than one. With these alias you can now record all your directory changes and go back whenever you need it. However you will have to get accustomed to use 'cd ~' from now on to go to your home directory.


    -2
    alias cd='pushd'; alias cd-='popd'
    conan · 2010-11-30 16:44:46 144
  • Sometimes when I find a new cool command I want to know: 1.- which package owns it, and 2.- are there any other cool commands provided by this package? Since I don't necessarily need to know always both, I don't use this version, but I bundle it into two separate functions: # get command package owner # it can work without the full path, but sometimes fails, so better to provide it with whereis command owner () { pacman -Qo `whereis $1 | awk '{print $2}'` } whatelse () { package=`owner ${1} | sed -e 's/.*is owned by \([[:alpha:]]\+\).*/\1/'` pacman -Ql $package | grep 'bin' } Show Sample Output


    0
    w=`whereis <command> | awk '{print $2}'`; p=`pacman -Qo $w | sed -e 's/.*is owned by \([[:alpha:]]\+\).*/\1/'`; pacman -Ql $p | grep 'bin'
    conan · 2010-10-01 04:28:04 3

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

Show sorted list of files with sizes more than 1MB in the current dir
no fancy grep stuff here.

Show top committers for SVN repositority for today

Write a shell script that removes files that contain a string
Deletes files in the current directory or its subdirectories that match "regexp" but handle directories, newlines, spaces, and other funky characters better than the original #13315. Also uses grep's "-q" to be quiet and quit at the first match, making this much faster. No need for awk either.

Find all the links to a file
This command finds and prints all the symbolic and hard links to a file. Note that the file argument itself be a link and it will find the original file as well. You can also do this with the inode number for a file or directory by first using stat or ls or some other tool to get the number like so: $ stat -Lc %i file or $ ls -Hid file And then using: $ find -L / -inum INODE_NUMBER -exec ls -ld {} +

Stream YouTube URL directly to mplayer.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

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.

Output requirements.txt packages pinned to latest version
Given a requirements.txt file with unpinned package names, output the packages pinned to the latest version. Handy to copy/paste back into your requirements.txt when you start a new project. Note that this will download packages but not install them.

Delicious search with human readable output
You can install filterous with $ sudo apt-get install libxslt1-dev; sudo easy_install -U filterous

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


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: