What Will I Learn?
Since I don't use Linux terminal every day, I often found myself in a situation, when I don't remember even the most basic commands. Because of this, to help myself and others, I decided to write an Utopian tutorial, where I collect/gather all the useful commands I found and use in Linux Mint, Ubuntu and the GNOME Terminal 3.18.3 in 2018.
This Utopian tutorial is focusing mainly commands used in Linux Mint, Ubuntu and GNOME Terminal, so the commands you find in this tutorial maybe doesn't work for example in Arch, openSUSE, Fedora or other not Debian/Ubuntu-based distributions and in other terminals.
I list every command as an answer to a given question, so if you look for a specific command, I suggest you use the Control+F key combination to search in this tutorial.
Requirements
- Debian/Ubuntu-based Linux distribution with GNOME Terminal (I use Linux Mint 18.3 Cinnamon 64-bit and GNOME Terminal 3.18.3) (the commands may work or may not work in other distributions and terminals)
- Intention to use the terminal in your Linux-based operating system
- Basic English knowledge to understand my tutorial
Difficulty
- Basic
Tutorial Contents
How to change user account in terminal?
su - user name (Like su - john)
How to give commands or run programs in/from the terminal as root user?
sudo additional commands or program name (like sudo nautilus or sudo apt-get install something)
How to update the list of the packages in the sources?
sudo apt-get update
How to update the system in terminal? (it's important to update the list of the packages before this)
sudo apt-get upgrade
How to update the Ubuntu LTS release to the next LTS release from terminal?
First make sure that the system is updated, then:
sudo update-manager -d
How to search for a given package or program in terminal?
sudo apt-cache search package/program name
Giving even a few characters in the name is enough.
How to install a given package from the terminal?
sudo apt-get install package name
How to run a program from terminal?
Simply type the name of the program and press enter.
Or type a part of the name of the program and press tab.
For example type Fir, and press the tab button and the program should complete the name to firefox, then press enter.
Or type ste and press the tab button and the program should complete the name to "steam", then press enter.
If you like to run as root, then:
sudo program name
As you can see from the example above, you can also run graphical programs from the terminal.
Why would you?
Because if you run a graphics program from the terminal, you can see a lot status and/or error messages that you would not see, if you would simply run the program.
Important! If you run one or more graphics programs from the terminal, please don't close the terminal window, while the program(s) is/are running, otherwise the/these program(s) will be closed as well.
The terminal will also give you the warning: "There are still processes running in some terminals in this window. Closing the window will kill all of them."
How to check the status of the firewall, that if it's turned on?
sudo ufw status
How to activate the firewall from terminal?
sudo ufw enable
How to deactivate the firewall from terminal?
sudo ufw disable
How to test a connection to a website?
Write ping website.name (for example *ping utopian.io) and press enter.
Press Control+C to stop the ping process.
The terminal will give you a statistics, like this:
My ping is currently 50-100 ms and I currently have a 10% packet loss, because I currently using mobile internet and I am accessing the internet from the countryside and the mobile internet is shared by Wifi and the connection is currently not so stable.
How to give permission to a file to make it executable?
sudo chmod +x filename
How to run a file from terminal? (Make sure that the file is executable)
./filename
How to list the files and directories/folders in the current place in terminal?
ls or dir
How to jump to a given directory/folder in terminal?
cd directory/folder name
How to go back from the current place to the previous from terminal?
..
How to make/create a directory/folder in terminal?
mkdir directory/folder name
How to remove/delete a directory/folder in terminal?
rmdir directiory/folder name
How to mount an ISO file and use it as a virtual drive?
sudo mount -o loop /place/and/the_name_of_the.iso /directory_folder/place/name
or
sudo mount -t iso9660 -o loop /place/and/the_name_of_the.iso /directory_folder/place/name
How to unmount the mounted ISO file in terminal?
sudo unmount directory_folder/name/place/where/the/iso/is/mounted
How to start the graphical user interface (GUI) from terminal?
startx
If you receive an error saying that the command is not found, you have to install the ubuntu-desktop package first:
sudo apt-get install ubuntu-desktop
If it's failed, it is possible that the window manager server (X server) is stopped working:
How to restart the window manager server (X server) from terminal?
Ubuntu 14.04:
sudo service lightdm restart
Ubuntu 16.04:
sudo service sddm restart
Kubuntu:
sudo service kdm restart
Xubuntu:
sudo service xdm restart
I hope you find this tutorial useful!
Thank you for reading!
Enjoy Steemit/Busy/ChainBB/Utopian and other sites! Have a nice day!
Posted on Utopian.io - Rewarding Open Source Contributors
Not a bad set of commands but you seem to want to use sudo to much. You only really need sudo if you don't have permission to do something. For example you use sudo to create a directory. You only need to do this if the location where you're trying to use is not user writable. This is a strong hint that this is probably not where you want to create a directory.
In general if you don't know you need sudo, don't use it and if you do need it think hard about why.
You can do a lot of damage to your system with sudo if you're not very careful.
Thanks for pointing out the thing about sudo. You are right.
However I usually don't use sudo to create directory/folder, so that was a typo.
I edited the post.
I also added the "How to remove/delete a directory/folder in terminal?" question and answer right after the "How to make/create a directory/folder in terminal?" question and answer, because I forgot that at the time of the writing of the post.
Hurrá, még egy linuxos! :))) Mióta kidobtam Bill Gates átkát, azóta nem szarakodik a gépem! :)))
Your contribution cannot be approved because it does not follow the Utopian Rules.
You can contact us on Discord.
[utopian-moderator]