Top menu

Monday, 12 December 2016

Useful Ubuntu Commands

1.       ls  list all the files in the current working directory.
  ls dir Lists the specified directory.

2.     rm remove the files from the directory.

3.       clear Clears the current screen of all text.

4.      cat file Concatenates (adds) the contents of the file to your screen.
  It’s like the MS-DOS type command.

5.       more file Displays the file one page at a time.

6.       tail file Displays the file one page at a time from the end of the file.

7.       pwd Shows name of the current directory.

8.      cd dir Changes to the specified directory.

  It’s like the MS-DOS chdir command.
  cd ("change directory") - Changes the directory you are currently working in.
  You can use full paths   to folders or simply the name of a folder within the directory you
  are currently working.
  Some common uses:

 cd / - Takes you to the root directory.
 cd .. - Takes you up one directory level.,
 cd - - Takes you to the previous directory.

9.   cp ("copy") - Allows you to copy a file.You should specify both the file you want copied and the location you want it copied to- for example: cp foo /home/johnwould copy the file "foo" to the directory "/home/john".

10. mv ("move") - Allows you to move files.You can also rename files by moving them to the directory they are currently in, but under a new name. The usage is the same as cp - mv foo /home/john would move the file "foo" to the directory "/home/john".

11.    rmdir ("remove directory") - Removes an empty directory.
 rm -r ("remove recursively") - Removes a directory along with its content.

12.    mkdir ("make directory") - Allows you to create a new directory. You can specify where you want  the directory created - if you do not do so, it will be created in your current working directory.

13.  history - Displays all of your previous commands up to the history limit.

Acquaint yourself with these help commands


14.   man - Displays a "manual page" on the specified command. Manual pages are usually very detailed, and it's recommended that you read the man pages for any command you are unfamiliar with. Some common uses:

man man - Provides information about the manual itself.
man intro - Displays a brief introduction to Linux commands.

15.   info - Similar to man, but often provides more detailed or precise information.
<command name> -h or <command name> --help provide a third alternative.
While not as detailed as the info or man pages, this will provide a quick overview of the
command and its uses.


Learn some commands related to displaying information about your system

16. df (display file system) - Displays information about the disk space usage of all mounted file  systems.  df -h uses KB, MB, and GB, if this format is preferred.

17.  du (directory usage) - Displays the size of a directory and all of its subdirectories. du -h can be used if KB, MB, and GB are preferred.


18.   free - Displays the amount of free space available on the system. To view the information in MB,  use free -m.


19.   uname -a - Provides a wide range of basic information about the system.

20.  top - Displays the processes using the most system resources at any given time. "q" can be used to exit.


1 comment: