The biggest advantage of this over the functions is that it is portable.
How often do you make a directory (or series of directories) and then change into it to do whatever? 99% of the time that is what I do. This BASH function 'md' will make the directory path then immediately change to the new directory. By using the 'mkdir -p' switch, the intermediate directories are created as well if they do not exist. Show Sample Output
Alias two dots to move to parent directory. Put it into your .bashrc or .profile file. Show Sample Output
This little function will smarten 'cd'. If you try to cd into a file (which I guess we all have done), it cd's into the directory of that file instead. I had to use nesten if's, to get cd to still work with 'cd' (to get to $HOME), 'cd -' (to get to last directory), and 'cd foo\ bar'. Show Sample Output
I wrote this a long time ago, wondering why this wasn't floating around somewhere out there (at least not where I could find).. this seems much more simple than multiple aliases and can cd out of directories easier. Show Sample Output
Another way of doing it that's a bit clearer. I'm a fan of readable code.
This is useful for quickly jumping around branches in a file system, or operating on a parellel file. This is tested in bash. cd to (substitute in PWD, a for b) where PWD is the bash environmental variable for the "working directory" Show Sample Output
`up 3` will climb the directory tree by three steps. `up asdf` will do nothing, and returns exit code 1 as an error should.
An easy method to generate ISOs from CD/DVD media.
Usage:
up N
I did not like two things in the submitted commands and fixed it here:
1) If I do cd - afterwards, I want to go back to the directory I've been before
2) If I call up without argument, I expect to go up one level
It is sad, that I need eval (at least in bash), but I think it's safe here.
eval is required, because in bash brace expansion happens before variable substitution, see http://rosettacode.org/wiki/Repeat_a_string#Using_printf
This is a kind of wrapper around the shell builtin cd that allows a person to quickly go up several directories. Instead of typing: cd ../.. A user can type: cd ... Instead of: cd ../../.. Type: cd .... Add another period and it goes up four levels. Adding more periods will take you up more levels.
Instead of typing "cd ../../.." you can type ".. 3". For extremely lazy typists, you can add this alias: alias ...=".. 2" ....=".. 3" - so now you can write just .... !!! NB the .. function needs to be "source"d or included in your startup scripts, perhaps .bashrc.
Obviously the example given is necessarily simple, but this command not only saves time on the command line (saves you using "cd -" or, worse, having to type a fully qualified path if your command cd's more than once), but is vital in scripts, where I've found the behaviour of "cd -" to be a little broken at times. Show Sample Output
Usage: upto directory Show Sample Output
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.
Also resolves symlinks, showing the full path of the link target
Change n directories up, without parameters change one up Show Sample Output
Change to your taste. Much quicker than having to add 'cd' every time. Add it to your .bashrc or .bash_profile.
Makes bash-4.x like zsh. Automatic cd into a directory if a command with that name doesnt exists. Ready for your ~/.bashrc file Show Sample Output
This creates a bash function `take` that you can call with the name of the directory as the first parameter. Add the function to ~/.bashrc to have it available anytime. Show Sample Output
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. Show Sample Output
switch to previous directory or toggle
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.
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
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: