Getting Started with Basic UNIX Command Line Operations

What is a command line and how is it used?

As computers- no matter how powerful they may be – do not have minds of their own and as such cannot perform tasks without being instructed to do so, always need a given a set of instructions that are fed into it by a user in order to perform a task. These instructions or set of instructions, aptly called commands, are what makes the computer perform the actions that you wished done. These set of commands allows humans to interact with their computers and instruct their computers what specific work needs to be done and how it is to be done.
Nowadays, a lot of computers users, especially those who are Windows or Mac users are so adept at manipulating and instructing their computers with the use of icons found on their desktop, known as Graphical User Interface or GUI. However, time was when all instructions that are fed into a computer are text commands, known as command lines. For a lot of us today, except those who are programmers and developers and those who are familiar with UNIX machines, the command line is unnecessary, obsolete and even archaic. The result is that, since most of our background with command line is with MS-DOS, we believe that command line is so difficult and intimidating.
However, the truth is that command lines are never obsolete and never unnecessary. UNIX continues to use command line as command lines are more powerful, flexible and are better connected to the inner function of the computer. This means that a command line user is more connected to his computer and as such understands how the computer functions compared to GUI users. Secondly, familiarity with the command line allows its user to better interact and instruct the computer to perform tasks that are often difficult or impossible with GUI’s. Thirdly, command line flexibility allows the user to combine one command with other commands which proves so vital in situations where a GUI is not able to perform or to perform tasks that are impossible with GUIs.

Is UNIX command line the same as MS-DOS?

Although at first glance, the UNIX command line looks virtually the same as the command line used in MS-DOS, their similarities are just superficial and the two are actually more different than similar. First and foremost, the UNIX command line is more powerful compared to the command line of MS-DOS and is known to be more flexible. Aside from this, the UNIX command line can do a lot more things compared to those of MS-DOS. Moreover, UNIX command line is known to be more user-friendly and is a lot easier than its MS-DOS counterpart.
If it is similarity that we look for, the UNIX command line is virtually identical to the command line of Unix-like and Linux machines, such as FreeBSD and Solaris. As such, becoming adept with the UNIX command line means that you have also become adept to the commands of all UNIX and Unix-like machines.

What are the most commonly used UNIX commands?

Although there are a lot of commands that UNIX users need to learn and understand in order to fully appreciate the power of a UNIX operating system, he must begin with a few basic and most commonly used commands. For a start, UNIX commands take the form of either a letter, or a set of letters, or a word or a set of words, all of which are case sensitive.
Below are some of the most commonly used UNIX commands:
Commands used for files:

  •  ls – command used to instruct the machine list your files;
  •  ls –l – command to instruct the computer to list the files in long format; including the file size, last modified, file owner and restrictions;
  •  ls –a – command used to list all your files
  •  mv[filename1][filename2] –command used to move filename1 into filename2
  •  cp[filename1][filename2] – command used to copy filename1 into filename2
  •  rm [filename1][filename2] – command used to rename filename1 into filename2
  •  emacs filename – command used to open a file editor; used to create and edit files

 Commands for File Compression tasks:

  •  gzip filename – command used to compress a file
  •  gunzip filename – command used to uncompress a file
  •  gzcat filename – command used to look at the contents of a compressed files without having to uncompress it

 Commands used for Printing

  •  lpr filename – command used to print a file
  •  lpq – command used to check the printer queue
  •  lprm jobnumber – command to be used when you want to remove a file from the printer queue.
  •  The jobnumber can be found with the use of the “lpq” command.
  •  genscript – command used to convert plain txt files into postscript for printing

 Commands for Directories

  •  mkdir dirname – command used when making a new directory
  •  cd dirname – command used to change directories. Changing directories actually means when the user needs to go to another directory
  •  pwd – command used to see where the user currently is

What are considered as among the most valuable UNIX commands?

Aside from learning the most commonly used basic commands, there are other commands that a UNIX user needs to master well as these commands are considered to be among the most valuable UNIX commands. These are:

  •  grep <str><files> – command to find which files contain a certain word;
  •  chmod <opt><file> – command to change file permissions to executable;
  •  passwd – command used to change password;
  •  ps <opt> – command to list running processes;
  •  kill <opt> <ID> – command used to kill a process;
  •   gcc (g++) <source> – command to compiles a program written in C++;
  •  telnet <host> – command to open a connection; and
  •  ftp <host> – command to upload or download file

Web Hosting Plan Guide