Commands by Velenux (4)

  • smbfs or cifs, depends on which you are using


    -2
    umount -t smbfs
    Velenux · 2012-02-23 10:46:44 3

  • -6
    for file in *; do echo $PWD/$file; done
    Velenux · 2011-12-16 13:12:00 4
  • Best way I know to get rid of .bash_history and don't allow bash to save the current one on exit Edit: added ~/ before .bash_history, just in case... ;)


    -5
    rm ~/.bash_history && kill -9 $$
    Velenux · 2009-10-08 12:25:47 9
  • Output is from Debian Lenny Show Sample Output


    1
    grep CONFIG $(which mysqlbug)
    Velenux · 2009-09-23 17:12:37 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

Copy the full path of a file to the clipboard (requires xclip or similar)
Handy for those times you need to paste a file path in an IDE or some other app. sudo apt-get install xclip Then, for convenience, alias xclip to 'xclip -selection c' so you can just do something like realpath . | xclip

Get your commandlinefu points (upvotes - downvotes)
This will calculate the your commandlinefu votes (upvotes - downvotes). Hopefully this will boost my commandlinefu points.

Rename files in batch

Convert seconds to [DD:][HH:]MM:SS
Converts any number of seconds into days, hours, minutes and seconds. sec2dhms() { declare -i SS="$1" D=$(( SS / 86400 )) H=$(( SS % 86400 / 3600 )) M=$(( SS % 3600 / 60 )) S=$(( SS % 60 )) [ "$D" -gt 0 ] && echo -n "${D}:" [ "$H" -gt 0 ] && printf "%02g:" "$H" printf "%02g:%02g\n" "$M" "$S" }

List only the directories
to include hidden dirs use: $ tree -adL 1 (with ls, requires 'ls -ad */ .*/')

Shows space used by each directory of the root filesystem excluding mountpoints/external filesystems (and sort the output)
Useful to see at glance which directory under the root file is using most space

Install pip with Proxy
Installs pip packages defining a proxy

Show a 4-way scrollable process tree with full details.
If you want a visual representation of the parent/child relationships between processes, this is one easy way to do it. It's useful in debugging collections of shell scripts, because it provides something like a call traceback. When a shell script breaks, just remember "awwfux".

SMTP Analysis
This works just as well for SMTP. You could run this on your mail server to watch e-mail senders and recipients: tcpdump -l -s0 -w - tcp dst port 25 | strings | grep -i 'MAIL FROM\|RCPT TO'

Shows you how many hours of avi video you have.
midentify.sh is part of mplayer, but you might have to locate it on your box.


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: