#stackoverlog#ubuntu

Some useful Ubuntu commands

Ubuntu commons

  1. Install a package: sudo apt-get install package_name.
  2. Remove file:
  3. rm something.mp3 anotherfile.mp4, if permission is required, prepend the command with sudo
  4. rm -f myfile.mp3: -f means “force” and you don’t need to confirm once time again to delete the file.
  5. You can use rm {first,second}.mp3 to remove a list of files with the same extension.
  6. Using wildcard * to delete the files map with the rule: rm *.mp3, rm hala*.mp3, etc.
  7. rm path/to/dir -R to remove a directory.
  8. Create a file: touch filename.mp3
  9. Open a file: gedit filename.txt
  10. Extract *.gz file:

    • tar -xvzf file-name.tar.gz with a couple things:
      f: this must be the last flag of the command, and the tar file must be immediately after. It tells tar the name and path of the compressed file.
      z: tells tar to decompress the archive using gzip
      x: tar can collect files or extract them. x does the latter.
      v: makes tar talk a lot. Verbose output shows you all the files being extracted.
      For simply you can only use tar -xf file-name.tar.gz.
    • In case you want to extact the file to the other path, use this: tar -xvzf file-name.tar.gz -C extract/to/this/path
  11. Open a file to edit in Text Editor: gedit file-name.txt
  12. Compress a folder: sudo apt-get install zip (if zip has not been installed yet) zip -r compressed_filename.zip foldername

Uninstall Nginx

  1. Remove all but config files: sudo apt-get remove nginx nginx-common
  2. Remove everything: sudo apt-get purge nginx nginx-common
  3. After remove Nginx, use sudo apt-get autoremove in order to remove dependencies used by nginx which are no longer required.

updating…

An Tran

An Tran

A passionate web developer, self-learner and music lover.

Read More