Friday, June 27, 2014

Basic commands

The Commands which are basically use to operate an Operating System(O/S) is called Basic Commands.  

1) pwd :  present working directory ---> used to know the path of present user.

2) ls : list ------>It gives the list of files & Directories present in the path


3) ls -l or ll --------> Listing of all files along with attributes


4) ls -a ------> Lists all hidden files & directories


5) ls -r -------> lists all files & directories in reverse mode


6) ls -il---------> lists all files & directories along with inode numbers


7) ls -ld < directory name> ------> to view attributes of a particular directory


8) ls -R <directory.name> -------> to view tree structure of a directory


9) ls -a* ----------> to view all files & directories starts with a


10) man < command> ---------> to view entire options of a command


To create a file we have 3 methods :

1) touch

2) cat

3) vi(vim)

1) touch : With the help of touch command we can create an empty file.
    
      syntax: touch < filename>
        
             ex: touch f1

   with this command we can create n number of files at a time.
       
           syntax: touch  <file1> <file2> <file3>
           ex: touch mahesh raju naveen

2)cat:  By using cat we can create data-files
   
     syntax: cat > <filename>
         ex: cat  >mahesh
             
              (edit data)
             ( ctrl+d)(to save)

 To view content of a file

    
           cat < filename>

To add data in existing file


           cat >> <existing filename>
       
            (enter-data)
            (ctrl+d)

we cannot edit the written text through cat command. we can only add data to modify existing data we have to use editors. we have number of editors in linux

      
             ex: gedit ,nano, kedit, kate, emacs ,vim ,etc...
  
   Note : but we always use the best editor "vim" editor .

we can transfer an output as input for another file
        
           ex: to view output of file1 file2 we use 

                    cat file1 file2
 In the same way, we can transfer output of that command as input for another file 
    
           ex: cat file1 file2 > file3
here we are giving file1 file2's data as input for file3 , by this data of file1&file2 will copied into file3.

No comments:

Post a Comment