Useful bash commands

From rbachwiki
Jump to navigation Jump to search

Go back to the previous directory

cd -

Clear Screen

ctrl + L

Background Taks

ctrl + z // send to background
fg // bring back 

if you type a command and forget to 'sudo'

sudo !! // this will add sudo to the previous failed command

Search through your previous commands

ctrl + R // then type part of the command you remember
history // will list previously run command

Rerun command from history

!100 // this is the number form the history list
ctrl + u // delete everyting on the prompt
ctrl + a // brings you to the front of the line
ctrl + e // end of the line

Run two commands, one after the other

command1; command2 // use semi;

Display output in columns

// pipe output into column command
mount | column -t