Linux Basic Command Manual

File and directory operations

  • ls - List: This command lists the contents of a directory. The name “list” succinctly describes its primary function, which is to display files and directories.

    ls # list the contents of a directory
    ls -l # show detailed information
    ls -a # show hidden files
    
  • cd - Change Directory: The cd command is used to change the current working directory in a shell. The term “change directory” directly reflects its purpose of moving from one directory to another.

    cd /path/to/directory # switch to the specified directory
    cd .. # to return to parent directory
    cd ./path # switch to the specified directory within the current directory
    
  • pwd - Print Working Directory: This command outputs the full pathname of the current working directory. “Print working directory” accurately describes the action of displaying the directory you’re currently in.

    pwd # display the full path of the current directory
    
  • mkdir - Make Directory: The mkdir command creates a new directory. The name “make directory” is a straightforward indication of its function to create (or “make”) a new directory.

    mkdir new_directory # creating a new catalogue
    
  • rmdir - Remove Directory: This command is used to delete empty directories. The name “remove directory” clearly states that it removes directories, emphasizing that it only works on empty ones.

    rmdir directory_name # delete empty directories
    
  • rm - Remove: Unlike rmdir, the rm command is used to remove files or directories (the latter requires an option to do so recursively). The term “remove” is generic because it applies to both files and directories.

    rm file_name # delete a file
    rm -r directory_name # recursive deletion of directories and their contents
    
  • cp - Copy: The cp command is used to copy files and directories. The term “copy” directly reflects its purpose to duplicate files or directories from one location to another.

    cp /source /destination # copy the source file to the target location
    
  • mv - Move: This command moves or renames files and directories. The name “move” is apt because it can move files or directories to a new location or simply rename them within their current directory.

    mv /source /destination # moving or renaming files or directories
    



    Enjoy Reading This Article?

    Here are some more articles you might like to read next:

  • All Task of Assembly Language 2024
  • Some points of Assembly Language 2024
  • DeltaConv:用于点云几何深度学习的各向异性算子
  • Доп. главы по Мат. Анализу
  • Программа государственного экзамена по направлениям магистратуры