Connect with us

Masters of Computer Science

Commands for Files and Directory Handling in Linux

Published

on

Commands for Files and Directory Handling in Linux

  • Cd
    • To change directory
    • E.g cd / [we are moving to root directory]

  • Cd..
    • Takes one level up of directory
    • E.g cd..

  • Ls
    • To list the items of directory
  • Ls –la
    • List content of directory including hidden files
    • E.g ls-la

  • Cp
    • Copies the content from file a to file b
    • If file b is not there, file b is created
    • It it exists, b is overwritten
    • E.g cp ict.txt byte.txt [we are copying content from ict.txt to byte.txt]
  • Cp –r
    • Copies content of directory
    • If second directory is not found, second directory is created
    • If it exists, content is overwritten

  • Mv
    • To rename files and directories
    • To move files and directories
  • Cat
    • Prints content of file
    • E.g cat filename.txt

  • Head
    • Prints first ten line of file
    • E.g head ict.txt
  • Rm
    • To delete file
  • Rm –f
    • Forecefully delets file

  • Mkdir
    • Create  a new directory if no exists
  • Mkdir –p
    • Creates nested directory
    • E.g mkdir /p example/ict/byte
  • Rmdir
    • Remove/delete directory

  • Pwd
    • Displays currently working directory
  • File
    • To determine type of file
    • E.g file filename
  • More
    • View text file in command prompt one screen at  a time if file is large
  • Less
    • Read content of text file one page per time
Facebook Comments
Advertisement

Facebook

Advertisement

Trending