Basic commands for Ubuntu


BASIC FILE HANDLING

1.      ps -e: displays currently running processes
2.      cd /path/to/dir : changes current directory to dir
3.      cd .. : goes up one directory
4.      dir : lists directory content
5.      ls: lists directory content (slight different than 'dir' as 'ls' differentiate files and directory with colors)
6.      man command: displays manual for the command
7.      cp : copies file or directory
8.      mv: moves file or directory
9.      rm – filename: remove a file
10.  rm -r dirname : removes a directory and all its content
11.  mkdir foldername : make directory
12.  clear: clear the screen
13.  pwd: shows present working directory
14.  ~: home direcotry


SYSTEM
1.      lsb_release -a : get Ubuntu Version (check this)
2.      uname -r: get kernel version
3.      uname -a: get all kernel information


APPLICATIONS
1.      gedit: text-editor
2.      firefox: browser
3.      libreoffice: document editor

FIREWALL
1.      ufw enable: turn on firewall
2.      ufw disable: turn off firewall
3.      ufw default allow: allow all connections by default
4.      ufw default deny : drop all connections by default
5.      ufw status: current status and rules
6.      ufw allow port: allow traffic on port
7.      ufw deny port: block port
8.      ufw deny from ip: block ip address
 
PACKAGE MANAGEMENT
1.      apt-get update : refresh available updates
2.      apt-get upgrade : upgrade all packages
3.      apt-get dist-upgrade : upgrade with packages replacements; upgrade Ubuntu Version
4.      apt-get install <pkg> : install package
5.      apt-get purge <package> : uninstall package
6.      apt-get autoremove : remove obsolete package
7.      apt-get -f install : try to fix broken package
8.      wget http://path-to-file.com : download file from given location

System Services
1.      system <name of service> status
2.      system <name of service> start
3.      system <name of service> stop
4.      system <name of service> restart
5.      system <name of service> runlevel


  Figure: The above figure shows the use of various service commands

PRIVILEGES
1.      sudo : run command as root
2.      sudo -s : open a root shell


FUNNY UBUNTU COMMANDS 
  1. fortune : Daily fortune
  2. cowsay <message> (install it "apt-get install cowsay")

 sl (apt-get install sl)

xcowsay (apt-get install xcowsay) 

rev <word or sentence> (this will reverse word or sentence)
fortune | cowsay (pipelining 'fortune command' with cowsay)

   yes <messege> (this will keep displaying the messege)
toilet <message>
cmatrix (apt-get install cmatrix)

  oneko

 
espeak ( a speech synthesizer for English (and several other languages) which will convert text to speech.)
 bb (get ready for movie)

 
 

This article/tutorial is written by Janak Kumar Lal, ICTV DDC Rautahat. For feedback, please comment on the article below.
Share on Google Plus

About Author (Janak Lal)

This portal "ICT for Local Bodies" is written by various individuals - ICT Experts and ICT Volunteers working under MoFALD/LGCDP with an aim of integrating ICT at Local Governance. The author is this post is mentioned at the end of the article itself (with their Google+ profile alongside). Learn more about ICT4LB KMDB here.