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

sleep until X o'clock
pauses exactly long enough to wake at the top of the hour

Show a config file without comments
Shows a file without comments (at least those starting by #) - removes empty lines - removes lines starting by # or "some spaces/tabs then #'" Useful when you want to quickly see what you have to customize on a freshly installed application without reading the comments that sometimes are a full 1000 lines documentation :) While posting, I saw this http://www.commandlinefu.com/commands/view/1041/display-contents-of-a-file-wo-any-comments-or-blank-lines But it's dirty and incomplete, to my mind My original goal was to remove lines like "\t*#" but I can't figure out how to do a egrep '\t' on a command-line. Two workarounds if needed: $egrep -v 'press control + V then TAB then #' /your/file or $egrep -v -f some_file /your/file #where some_file contains what you want to exclude, example a really inserted TAB

Calculate days on which Friday the 13th occurs (inspired from the work of the user justsomeguy)
Friday is the 5th day of the week, monday is the 1st. Output may be affected by locale.

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

Create a mirror of a local folder, on a remote server
Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)

Print all git repos from a user

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"

Geolocate a given IP address

Convert CSV to JSON
Replace 'csv_file.csv' with your filename.

find both total size and number of files below any given svn directory
afaik, svn doesn't have a good, scriptable way of telling you these two basic pieces of information.


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: