Wednesday, January 2, 2013

UNIX Commands

USERS

About Users:

$ users

LoggedIn :

$ who


FILE OPERATIONS

Listing File :

$ ls

Listing File(more Info) :

$ ls -1

Listing File(search all the file name starts with 'ch' and end with '.doc') :

$ ls ch*.doc


Listing File(Hidden) :

$ ls -a

Create File :

$ vi neelmani
$ ESC :q [exit without saving]
$ ESC :wq [save and exit]

Displaying the content of a File :

$ cat Neelmani

Displaying the content of a File[by line number] :

$ cat Neelmani -b


Counting Words in a File :

$ wc Neelmani



Copying File :

$ cp Neelmani NeelmaniDuplicate

Renaming(changing Name) file :

$ mv Neelmani Neel

Deleting Files :

$ rm Neelmani

$ rm Neelmani Jaiswal


DIRECTORY OPERATIONS

Create Directories :

$mkdir jaiswal
$

$mkdir /mca/jaiswal
$

Removing Directories :

$ rmdir Neelmani
$ rmdir Neelmani Jaiswal

Changing Directories :

$cd /usr/local/neel


Renaming Directories :

$mv neelmani jaiswal
$



Permission Indicator :

$ls -l /home/neelmani

-----------------------------------

  • cat --- for creating and displaying short files
  • chmod --- change permissions
  • cd --- change directory
  • cp --- for copying files
  • date --- display date
  • echo --- echo argument
  • ftp --- connect to a remote machine to download or upload files
  • grep --- search file
  • head --- display first part of file
  • ls --- see what files you have
  • lpr --- standard print command (see also print )
  • more --- use to read files
  • mkdir --- create directory
  • mv --- for moving and renaming files
  • ncftp --- especially good for downloading files via anonymous ftp.
  • print --- custom print command (see also lpr )
  • pwd --- find out what directory you are in
  • rm --- remove a file
  • rmdir --- remove directory
  • rsh --- remote shell
  • setenv --- set an environment variable
  • sort --- sort file
  • tail --- display last part of file
  • tar --- create an archive, add or extract files
  • telnet --- log in to another machine
  • wc --- count characters, words, lines