commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
I use this alias in my bashrc. The --vi-keys option makes info use vi-like and less-like key bindings.
For vi(m) users :
Add it in your ~/.bashrc
Add an "exit" @ the end if you are masochist ;)
This uses mpg123 to convert the files to wav before burning, but you can use mplayer or mencoder or ffmpeg or lame with the --decode option, or whatever you like.
The preferred way for scripts (and easier to parse)
Put this in your ~/.bashrc file (or the equivalent)
If you use vim a lot, this alias will be immediately obvious. Your brain will thank you.
In Bash, when defining an alias, one usually loses the completion related to the function used in that alias (that completion is usually defined in /etc/bash_completion using the complete builtin).
It's easy to reuse the work done for that completion in order to have smart completion for our alias.
That's what is done by this command line (that's only an example but it may be very easy to reuse).
Note 1 : You can use given command line in a loop "for old in apt-get apt-cache" if you want to define aliases like that for many commands.
Note 2 : You can put the output of the command directly in your .bashrc file (after the ". /etc/bash_completion") to always have the alias and its completion
Makes it easy to add keys to new ppa sources entries in apt sources.list
Now to add the key for the chromium-daily ppa:
Just find out the daemon with $ netstat -atulpe. Then type in his name and he gets the SIGTERM.
When you have to manage lot of servers, it's boring to type ssh root@myhost for each connection. Now you can type juste "s someting" and you are connected.
You can too add bash_completion script to complet with tab the name of your servers. This will be the next tips from me ;)
Not a discovery but a useful one nontheless.
In the above example date format is 'yyyymmdd'. For other possible formats see 'man date'.
This command can be also very convenient when aliased to some meaningful name:
alias mkdd='mkdir $(date +%Y%m%d)'
This is a simple command, but extremely useful. It's a quick way to search the file names in the current directory for a substring. Normally people use "ls *term*" but that requires the stars and is not case insensitive. Color (for both ls and grep) is an added bonus.
Coming back to a project directory after sometime elsewhere?
Need to know what the most recently modified files are?
This little function "t" is one of my most frequent commands.
I have a tcsh alias for it also:
alias t 'ls -ltch \!* | head -20'
parses the output of ifconfig to show only the configured ip address (in this case from interface eth0).
the regexp is quick'n'dirty im sure it can be done in a better way.
--> this alias does not show your "internet ip" when you're in a nat-environment
An alias i made for myself to play music in a faster way.
Works great when you have Guake / Tilda installed (Console that drops down like in the game QUAKE)
I put this in my bash_alias file (I'm on ubuntu, the bash_alias file does autostart with the right config) but it works putting it in bashrc too. Or anything that autostarts when the console is opened.
Needs Mplayer and music files to work. With out music theres nothing to play!
Oh, and also, without modification, this alias will try to play stuff from your ~/Music folder! (case sensitive). Make sure that folder exists and has music OR edit this alias to fit your needs.