Start backwards search through command history for all commands containing "keyword". Works in bash, and even in ROOT prompt!
Beeps, or rings visual bell, etc.
If your terminal is set up to transmit visual bells, beeps, etc, it can alert you when a long command finishes.
For example:
./run_long_command.sh; echo -e "\a"
You can use many emacs style bindings to delete a word forwards or backwards (Alt+Backspace or Alt+d), kill line (Ctrl-k), and even undo (Ctrl+_). Other useful bindings: Alt-f/Alt-b to move forwards/backwards by single word Ctrl-a/Ctrl-e to move to start/end of line
Runs command in the background, so you can do other stuff.
Note: If <command> produces command line output, it will show up on your prompt, which makes it hard to see what's going on.
To fix this, you can direct both the stdout and stderr of a command to a file instead.
In bash: <command> > log.txt 2>&1
Doing <command> >> log.txt 2>&1
appends to file instead.
You should not have multiple processes writing to the same file at the same time though.
Suspends current process.
You can bring it back to the ForeGround by typing fg
. This is very useful for having an editor session running while you do other things in the terminal.
You can also put the process in the BackGround by typing bg
, which is just like doing <command> &
but you can do it after you've already started running the command.
If you have more than one suspended processes, you can do jobs
to find out what they are, then do fg %<jobnumber>
to bring up a specific one.
You can use semi-colons (;
) to chain commands together. Each command will run after the previous one has completed.
You can use double ampersand (&&
) to chain commands, with each command ONLY executing if the previous command did not return an error.
For example: In make && ./main
, ./main
will only run if the make
command was successful.
Note: A command is considered to have completed error-free, if it returns exit code 0. Any other return code is considered an error. If your compile commands are in a script as in the example above, you have to make sure that your script returns a non-zero exit code, if compilation fails.
Use # to pass multiple files with similar names to a command.
For example, rm *.txt
removes all files in the current directory with the file type ".txt".
cp dir1/* dir2/
copies all files in dir1 to dir2.