Bash Command Line Pro Tips
Rate it:
Open Preview
Kindle Notes & Highlights
Read between December 30 - December 30, 2020
14%
Flag icon
Using tab completion is one of the easiest ways to increase your efficiency at the command line.
David
Todo a golpe de teclado
14%
Flag icon
Tab completion can be used to autocomplete file names, directories, commands, arguments, and more.
23%
Flag icon
To enable programmable completion on an Ubuntu system, source /etc/bash_completion.  You can add this command to your personal initialization files
26%
Flag icon
A quick way to return to your previous directory is to use the "cd -" command.  Your previous working directory is stored in an environment variable named $OLDPWD.  The commands "cd -" and "cd $OLDPWD" are the same.
David
"cd -" no es lo mismo que "cd .."
34%
Flag icon
to run another command against the last item on the previous command line.  To access that item in your current command, use "!$".
41%
Flag icon
To run the most recent command that begins with a given string, use an exclamation mark followed by that string.  For example, to run the last command that started with a "d", type "!d<ENTER>."
46%
Flag icon
If you want to use the output of one command in another command line, use command substitution.  You can perform command substitution by using backticks (`) to surround a command or a dollar sign followed by parenthesis that surround a command.  Surrounding a command with backticks is the older style and is being replaced by the dollar sign syntax.  The output of the command can be used as an argument to another command, to set a variable, or for generating the argument list for a for loop. ...more
52%
Flag icon
When I need to perform the same action for multiple items, I use a for loop right from the command line.
58%
Flag icon
it's really easy to repeat the previous command with superuser privileges.  If sudo is configured on your system, run sudo !!, otherwise run su - c "!!".
71%
Flag icon
The "!#" string represents the current command line.  To reuse an item on the same command line follow "!#" with ":N" where N is a number representing a word.  Word references are zero based, so the first word, which is almost always a command, is :0, the second word, or first argument to the command, is :1, etc.
74%
Flag icon
I gave in and created an alias to compensate for my sloppy typing.
75%
Flag icon
also create aliases for commands that I use frequently.  Even though some of these aren't extremely long or difficult to type,
David
Crea alias pero como no los uses..... se te olvida su nombre