Ubuntu – List of useful commands

Linux is most used operating system now a days. Here are list of some of the very useful ubuntu commands.

1) How to compress files in ubuntu?

If you want to create ZIP files using Ubuntu (or almost any other Linux), use zip. You can install it to Ubuntu by running following command.

sudo apt-get install zip
zip -r filename_compressed.zip foldername


You can also use tar instead of zip. The tar command on Linux is often used to create .tar.gz or .tgz archive files


  • Compress an Entire Folder or a Single File

    tar -czvf name-of-compressed.tar.gz /path/to/folder-or-file

Here are some more details about command:

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
  • -f: Allows you to specify the filename of the archive.


   tar -czvf foldername.tar.gz foldername


  • Compress Multiple Directories or Files at Once.
    tar -cf myfile.tar /etc/mydir /var/www/html /home/mydir
    tar -cf myfile.tar.gz /etc/mydir /var/www/html /home/mydir


  • Excluding directory when creating zip or tar compression

    tar -pczf MyBackup.tar.gz /home/user/public_html/ --exclude   "/home/user/public_html/tmp"

2) How to uncompress or unzip file in ubuntu

If the unzip command isn’t already installed on your system, then run:
sudo apt-get install unzip

After installing the unzip utility, if you want to extract to a particular destination folder of directory, you can use:

unzip file.zip -d destination_folder

uncompress tar.gz file with following command
tar -xvzf my_images.tar.gz
3) How to download file from website with ubuntu command or terminal

Suppose we have url of desired file is – http://www.mydomain.com/uploads/images.zip

You can download above file with simple command wget

wget http://www.mydomain.com/uploads/images.zip

To download the file to the particular directory.
wget /home/ubuntu/mydir http://www.mydomain.com/uploads/images.zip

4) How to change file permission with ubuntu command or terminal

chmod command is useful to change file permission

chmod 755 my_app
Recursively change permission to folder, subfolders and all its files. If you want to change permissions of all files and directories at once.
chmod -R 755 /opt/lampp/htdocs

Free SEO Checker |
Test your website for free with OnAirSEO.com

Get Your SEO report!

Don’t miss the next post!


Related Posts