Common Linux Shell Command Reference

If you want to copy all the files and folders from /path/folder/ to /other_path/folder/ you would...

Move to the Source Folder


cd /path/folder/

Copy All Files from Current Folder to Destination Folder


cp -R * /path/destination/folder/

Mount New Disk


  1. Create Folder to Mount Too

    mkdir /path/folder
    ie: mkdir /media/disk1

  2. Mount the Disk

    mount -t {file-system-type} /disk/id /media/disk1

    -t indicates the type of file system - vfat = FAT32
    /disk/id indicates the disk identification - this can be attained by typing "fdisk -l" to list all available disks

Basic Directory Operations


  • List Directory Contents

    ls -al

  • Change Directory

    cd dirname

  • Make Directory

    mkdir dirname

  • Remove Directory (and all contents)

    rmdir dirname -Rf

Create TAR.GZ Gzip Compressed Tarball Files (For BACKUP, STORAGE, or TRANSFER)


  • Create TAR.GZ of all folder contents

    tar -czvf filename.tar.gz .
    tar cvf - . | gzip > filename.tar.gz

  • Create TAR.GZ of just JPG images (for example)

    tar -czvf filename.tar.gz *.jpg
    tar cvf - *.jpg | gzip > filename.tar.gz

  • Extract TAR.GZ contents (into current folder)

    tar -xzvf filename.tar.gz
    tar xvfz filename.tar.gz

How to Recursively CHMOD Files and Folders


  • Recursively CHMOD Folders Only

    find . -type d -exec chmod 755 {} \;
  • Recursively CHMOD Files Only

    find . -type f -exec chmod 644 {} \;


  • learning, linux, vps, commands
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How can I use SSH to connect to my server ?

How to use PuTTY to connect to a server   Start PuTTY by double-clicking its icon   You...

How do I change my hostname?

1. Login to server via SSH as root.2. Run the following command to change host name:3. hostname...

How do I find a file in Shell?

Type in "locate name_of_file_or_folder" > Press Enter

How do I know which ports are open on my system?

To get a list of listening network ports (TCP/UDP sockets): 1. Login to your dedicated server as...

What is OpenVZ?

OpenVZ is container-based virtualization for Linux.

Powered by WHMCompleteSolution