Ubuntu is a Linux-based operating system and distribution for personal computers and smartphones. It is based on free software and uses Unity as its user interface. A fresh Ubuntu copy contains a variety of software like LibreOffice, Firefox, Thunderbird, Transmission, and several lightweight games. Ubuntu also has its software center from where we can download software packages and games. And if we talk about security, Ubuntu is one of the best in business.
Ubuntu uses the sudo tool to assign temporary privileges for performing administrative tasks and keeps the root account locked so that inexperienced users can’t make any changes to the system. In Ubuntu, most network ports are closed by default to prevent hacking and PolicyKit is been implemented to further harden the system.
In Ubuntu, there is a program called “Terminal” which works in a similar way as “command prompt” works in Windows. It is a text-based interface that grants access to the UNIX system. It is used to run specific commands, change system settings, create folders, and many other features that are not available through programs with graphical user interfaces. In this article, we present you a list of 20 useful Ubuntu commands to make your work easier.
Useful Ubuntu Commands
-
Check the Current CPU Architecture
To check whether your system is 32-bit or 64-bit, you can use any one of the following commands:
- arch
- uname -m
- file /bin/bash | cut -d’ ‘ -f3
-
Make an ISO File
If you want to make an iso file from a folder containing other sub-folders via the terminal you can use the following command:
mkisofs -o image.iso -R /path/to/folder/
If you want to make the backup of the home folder, use the following command:
mkisofs -o image.iso -R $HOME
-
Generate Random Passwords
There are 2 ways to generate random passwords:
- Using “makepasswd” command line tool
- Using OpenSSL command
Using “makepasswd” command line tool
“makepasswd” is a command line tool used for generating passwords in Ubuntu. To generate random passwords, first we have to install makepasswd command line. We can install it using this command:
sudo apt-get install makepasswd
Now, to generate a random password of 20 characters, you can use the following command:
makepasswd --chars=20
Using “OpenSSL” command
You can use the following command to generate random passwords:
openssl rand -base64 20
In both the commands, for generating passwords of any number of characters replace “20” with the number of characters you want.
-
Remove Non-Empty Folder
If you want to remove a non-empty folder, use the following command:
rm -rf /path/to/folder/
-
Check Information on Your Video Card
To check the information on your graphic card like the manufacturer’s name, and size of the video card you can use the following command:
lspci -v -s `lspci | awk '/VGA/{print $1}'`
-
Check the Uptime of Your Computer/Laptop
If you want to checkhow long your computer/laptop is running after you powered it on, you can use the following command:
uptime
If you want to monitor system uptime in real time, use the following command:
watch -n 1 uptime
-
Check CPU Temperature
To check the current temperature of your CPU, use the following command:
acpi -t
To check the temperature of CPU in real time, use the following command:
watch -n 1 acpi -t
-
Download and Extract Tar Files
If you want to extract a file after downloading it, use the following command:
wget URL-To-TAR-File -O - | tar xfz -
Below is an example of this:
wget http://garr.dl.sourceforge.net/project/multibootusb/MultiBootUSB_4.7.tar.gz -O - | tar xfz -
-
Block or Unblock Wi-Fi and Bluetooth
You can enable or disable Wi-Fi and Bluetooth using “rfkill” command.
To disable Wi-Fi:
rfkill block wlan
To enable Wi-Fi:
rfkill unblock wlan
To disable Bluetooth:
rfkill block bluetooth
To enable Bluetooth:
rfkill unblock bluetooth
-
Check RAM Speed
To check RAM speed using the terminal, use the following command:
 sudo dmidecode -t 17 | awk -F":" '/Speed/ { print $2 }'
-
Check Read/Write Speed of a Hard-Disk
To check the read and write speed of your hard disk, use the following command:
sudo hdparm -tT /dev/sda
-
To Change Read Speed of a CD/DVD
For changing the read speed of a CD/DVD, first, you need to know the maximum read speed. You can check the maximum read speed using the following command:
eject -X
To increase or decrease the read speed of an optical drive, use the following command:
eject -x 4
For more than one optical drive, use the following command:
eject /dev/cdrom -x 4
-
Downloading Websites
You can download an entire website using the terminal. To do this use the following command:
wget --recursive  --page-requisites --convert-linkswww.domain.com
-
Monitor Network Usage
To monitor network usage IPTraf command is used. Before using this command, you need to install it. To install “IPTraf” command line, use the following command:
 sudo apt-get install iptraf
Now you can monitor network usage using this command:
sudo iptraf
-
Monitor HDD Temperature
You can use either of these commands to monitor the temperature of your hard disk drive:
sudo apt-get install hddtemp
or
sudo hddtemp /dev/sda
-
Check Unread Gmail Messages
You can read your unread Gmail messages using the following command:
curl -u GMAILUSER --silent "https://mail.google.com/mail/feed/atom" | perl -ne 'print "\t" if //; print "$2\n" if /<(title|name)>(.*)<\/\1>/;'
-
Force Kill Apps
To kill an unresponsive app use the command xkill in the terminal and click the software window to close it.
- Check Current Kernel Version
You can check the current Kernel version using the command uname -r in the terminal.
-
Screen Recording
You can record your screen as a video using the command “ffmpeg”. Before using this command, you need to install it. You can install “ffmpeg” using the following command:
sudo apt-get install ffmpeg
Now to capture your screen and record it as video, use the following command:
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq output.mpg
-
Dtrx Tool
The dtrx tool is used to extract files without the need to memorize various extraction commands. To install the dtrx tool, use the following command:
sudo apt-get install dtrx
Below are some examples of dtrx tool:
- dtrx file.zip
- dtrx file.tar.gz
- dtrx file.7z
This is our list of 20 useful commands to make your work easier on Ubuntu. If you know some other beneficial commands feel free to share them in the comments section below.