Basic Linux Command Line#

Open a terminal.

  • whoami: Displays username.

    whoami
    
  • hostname: Displays the name of the current host.

    hostname
    
  • pwd (Print Working Directory): Shows the current directory (folder).

    pwd
    
  • ls (List): Lists the files and directories in the current directory.

    ls /SNS
    ls /HFIR
    
  • cd (Change Directory): Moves to a different directory.

    cd /SNS
    cd /HFIR
    cd ~/
    
  • mkdir (Make Directory): Creates a new directory.

    mkdir new_directory
    
  • touch: Creates an empty file or updates the timestamp of an existing file.

    touch filename
    
  • cp (Copy): Copies files or directories.

    cp source destination
    
  • mv (Move): Moves or renames files or directories.

    mv source destination
    
  • rm (Remove): Deletes files or directories. This action is irreversible.

    rm file_name
    
  • nano or vim (Text Editors): Opens a terminal-based text editor to create or modify files.

    nano filename
    
  • gedit (Text Editors): Opens a GUI-based text editor to modify files.

    gedit filename
    
  • cat (Concatenate and Display): Displays the content of a file.

    cat filename
    
  • man (Manual): Displays the manual pages for a command. Provides detailed information about the command and its options.

    man command_name
    
  • echo: Prints a message or a variable to the terminal.

    echo "Got Neutrons?"
    
  • history: Displays a list of recently used commands.

    history
    
  • chmod (Change Mode): Changes the permissions of a file.

    chmod permissions filename