Linux – File And directories


  • rm abc  (can remove a file)
  • mkdir abc (create a directory)
  • rmdir abc (remove an empty directory)
  • rm –r abc (delete directory recursively)
  • mkdir /data (create a directory)
  • mkdir /data/abc (create sub directory)
  • pwd (print working directory)
  • cd /data ( change the directory)
  • cd (change to home directory)
  • cd / (change to / directory)
  • cd .. (come back one directory)
  • cd – ( back to previous directory)
  • tree /root ( to display directory structure)
  • rm –rf  abc ( to delete a directory forcefully & recursively)
  • ls (list of files and folders in current directory)
  • ls –l (long listing of files & folders)
  • ls –a (list all with hidden files & folders)
  • ls /  (list files & folders )
  • ls /abc/xyz (will list subdirectories)
  • cp –rvf /abc/xyz  (copy recursively)
  • ls *.txt (list .txt files)
  • history (displays last inserted commands)
  • !10 (run number 10th command)
  • !cal (run last command started with cal)
  • history –c (Clear all history)
  • man/info date (manual files)
  • makewhatis (creates what is database)
  • whatis cal (displays use of cal command)
  • cal > abc ( send output of cal  to file abc)
  • date >> abc (append to abc file)
  • more sales.txt (displays page contents page wise)
  • history | more (displays history page wise)
  • history | less (———— can up and down)
  • history | tail -20 ( displays last 20 inserted lines)
  • History > history.txt (send history to a file)
  • tr ‘a-d ‘ ‘A-D’ < sam.txt ( display small to capital)
  • tr ‘A-D ‘a-d’ < sam.txt (displays capital to small)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: