Bash Commands

From Open Source Ecology - Germany
Jump to navigation Jump to search

See also

Get help

 apropos ftp # searches for all program descriptions with ftp
 man 7z # manual page for 7z
   # shift + ? → searching a string (by regular expression)
   # shift + n/n → find the next/previous match
   # q → quit

Most commands provide a help option and the following works:

 a-command --help
 a-command -h
 # sometimes there is an info on usage
 a-command --usage


# Download the given file and overwrites the local one according to the file’s timestamp
wget --timestamping http://...
wget -N http://...

File Management

gksudo nautilus # (start it as root)

Text Search

Search text in files:

grep -r "your text" <directory>


# print the path of the executable file
which <executable> 
# search for a file or directory with the given filename
find <dir> -name <filename>

Chmod Calculator

Set rights with chmod, e.g add executable rights chmod u+x

See also for setting rights numerically.

User Management

Add a User

sudo adduser <username>


tar -xzf <filename>.gz
tar --extract --gzip --file=<filename>.gz

Cron Jobs

# run with -s (shell environment variables)
sudo -s <command>
sudo -s crontab -e # crontab -e: edit crontab jobs to add or remove cron jobs

Create Screens

screen # saves your screen even after session time out
screen -r # resumes a detached screen session
  • Ctrl+AC (create new terminal tab)
  • Ctrl+AA (switch between terminal tabs)


  • sudo ./backupAll.bash <backupname>


sudo shutdown -h 18:45 # at 18 o’clck 45min