Linux - Helpful commands

TODO

  1. https://www.redhat.com/en/blog/linux-system-info-commands
  2. https://www.redhat.com/en/blog/one-line-linux-commands
  3. https://www.redhat.com/en/blog/linux-commands-to-know

Refresh config files

Refresh .profile

source $HOME/.profile
. ~/.profile

Refresh .bash_profile

source $HOME/.bash_profile
. ~/.bash_profile

OS information

Type any one of the following command to find os name and version in Linux

cat /etc/os-release
lsb_release -a
hostnamectl

System information

To figure out if your computer has 64 bit or 32 bit processor :

uname -a
lscpu (look at the architecture row)

System commands

command description
systemctl -help
systemctl suspend command to put the system in sleep/suspend mode
systemctl hibernate command to put the system in hibernate mode
reboot command to reboot from terminal
systemctl list-units List units currently in memory

View ip address of the computer

Command to view ip address: hostname -I

list commands

command description
ls ltra command to show all files and folders including hidden ones
ls –all command to show all files and folders including hidden ones
ls -ltaX
ls -l –block-size=M (round file sizes to the nearest MB) To make `ls` show file sizes in megabytes
ls -l –block-size=MB To make `ls` show file sizes in megabytes
ls -l –block-size=K To make `ls` show file sizes in kilobytes

Installing tar files

command to install a tar file in linux : how to use sudo command to install .tar.gz : Open a console, and go to the directory where the file is

tar -zxvf file.tar.gz

Toggle full screen : F11

E212: Can't open file for writing

Vim has a builtin help system. You might want to edit the file as a superuser as sudo vim FILE


Links to this note