Tuesday, 24 July 2012

Unix commands and working

The audio blog for the blog is at http://yourlisten.com/channel/content/16906239/Linux_commands

Before getting into the commands let us see the Linux directory structure.

/ :
 This is the root directory. Every other folders are under the root directory. This usually contains the sub folders so its best no to keep any direct files in it.

< /boot >
       This folder contains the information it needs when it is getting booted.

< /bin, /usr/bin >
        This folder contains important program like ls,grep etc.,

< /usr >
 It is the largest directory in the linux.
 Inside the usr directory we have these following folders.

doc : Documentation for the user apps, in many file formats.
share : Config files and graphics for many user apps.
src: Source code files for the system's software, including the Linux kernel.
include : Header files for the C compiler. The header files define structures and constants that are needed for building most standard programs. A subdirectory under  contains headers for the C++ compiler.

 </var>
          It has the data which will be constantly changing during the system execution. They contain directories like , log - to to contain the log information,
mail - to have the sent and received mails , spool - to contain the jobs which are queued up for process(eg. printing).

</dev>
        It has the various devices attached to the file system.

Now lets brush up a few linux commands which we normally get to use,

  • ls - to list all the files and directories in the current directory.
  • mv- moving file names.
  • rm- remove the file.
  • rmdir - remove directory.
  • rm -r - removes the directory with all the files ans sub directory inside it.
  • cp filename filename2 - creates the same file with the name as specified in the second parameter.
  • scp filename destination@ip_address - this will upload the given file into the destination address.
  • scp destination_name@ip_address:/path/filename - this will get the file from the destination to our machine.
  • ssh ip_address : This will let us to access the system of the given ip_address through the terminal.
  • chown - to change owner of a file
  • chmod - to change the mode of a given file
  • To start any any network application we can use /etc/init.d/application_name start.
  • ping url - used to check whether the given website is working.
  • ps -elf | grep application name -this will give the details of a particular process.
  • tail -n - prints the last n lines of the file
  • head -n - prints the first n lines of the file
  • top - it is simliar to ps but it shows the real time usage while ps is shows average values over a given snapshot.During top if you press shift + p it will give
  • kill - to kill a particular process given the process id. The process id can be found by using grep command along with the application name.
  • cat , less ,more - these are display commands which is used to display the given file in th terminal.
  • df - disk usage of the file system.
  • du - disk usage of each processes. 
       To know about more commands check this given link
       http://www.oreillynet.com/linux/cmd/



       

No comments:

Post a Comment