Some useful Ubuntu commands
Ubuntu commons
- Install a package:
sudo apt-get install package_name
. - Remove file:
rm something.mp3 anotherfile.mp4
, if permission is required, prepend the command withsudo
rm -f myfile.mp3
:-f
means “force” and you don’t need to confirm once time again to delete the file.- You can use
rm {first,second}.mp3
to remove a list of files with the same extension. - Using wildcard
*
to delete the files map with the rule:rm *.mp3
,rm hala*.mp3
, etc. rm path/to/dir -R
to remove a directory.- Create a file:
touch filename.mp3
- Open a file:
gedit filename.txt
-
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 usetar -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
- Open a file to edit in Text Editor:
gedit file-name.txt
- Compress a folder:
sudo apt-get install zip
(ifzip
has not been installed yet)zip -r compressed_filename.zip foldername
Uninstall Nginx
- Remove all but config files:
sudo apt-get remove nginx nginx-common
- Remove everything:
sudo apt-get purge nginx nginx-common
- After remove Nginx, use
sudo apt-get autoremove
in order to remove dependencies used by nginx which are no longer required.
updating…