In this blog, you will be able to use some useful Linux Commands that can help in your day to day work
| Command | Description |
|---|---|
hostnamectl |
Check the Linux version (e.g., on CentOS). |
du -h |
View the overall **Disk Usage** in human-readable format. |
du -sh * |
View the size of directories and files in the **current directory**. |
du -chs |
View the **total size** of a specified folder or file. |
df -h |
Shows the **remaining disk space** and disk usage across all mounted filesystems. |
ls |
List the contents of the current directory (the "list view"). |
ls -l |
View the **long list** format of the directory contents, showing permissions, owner, size, and date. |
ls -lh |
View the **long list** format with sizes displayed in **Human Readable** units (e.g., GB, MB). |
sudo -i |
Elevate user privileges to the **root** user with a full environment. |
sudo du -h --max-depth=1 -x |
View what is taking up space in the **server**'s current directory, limited to one level deep. |
top |
Shows the **memory and CPU operations** currently running (processes, memory usage). |
free -mh |
Shows the **memory in use and free** in a human-readable format (MB, GB). |
rm -rf dirname |
**Remove a directory** and all its contents **without prompting** for confirmation. |
rm -f filename.extension |
**Force delete a file** without prompting for confirmation. |
sudo passwd root |
Create or change the password for the **root user**. |
sudo systemctl status ssh |
**Check the Status of the SSH service**. |
lsb_release -a |
Displays **LSB (Linux Standard Base)** and distribution-specific information. |