Wednesday, December 18, 2013

Linux: Directories & Files

     I. Directory

  +
    
1. Display your current directory.

#pwd

    2.   Change to the /etc directory.

#cd /etc

     3. Go to the parent directory of the current directory.
#cd ..

     4. Go to the root directory.

#cd /

    5.  List the contents of the root directory.

#ls

   6. List a long listing of the root directory.

#ls -l

      7.   List the contents of /etc.

#ls /etc

     8. List the contents of /bin and /sbin.

#ls /bin /sbin

     9. List the files in /boot in a human readable format.

#ls -lh /boot

    10. Create a directory “data” in your home directory.

#mkdir ~/data

    11. Remove the directory named “data”.

#rmdir data


Linux AB news

II. Files

   1.   To create a file:


#touch file1

   2.   To remove a file:


#rm file1

  3.   To remove non-empty directories:

#rm –rf

  4.   To copy a file to a directory :

 #cp file1 /data

  5.   To rename a file:

 #mv file1 file2



No comments:

Post a Comment