Linux is an open-source operating system that has been used by millions of people worldwide. In this article, I’ll teach you some basic Linux commands so you can start using it today!
Basic Linux Commands
Command Description hostnamectl
Get system information including, operating system, kernel, and release version date
Display the current system date and time hostname
Display the hostname of the system ifconfig
Display the IP and Mac Address of the system w
Display currently logged in users in the system free -m
Display free and used memory in the system top
Display all running processes ls
List all files and directories in the current working directory ls -al
List all files and directories including, hidden files and other information like permissions, size, and owner cd
Change the directory to the home directory cd ..
Change the directory to one level up cat filename
Display the content of the file cat file1 file2 > file3
Combine two files named file1 and file2 and store the output in a new file file3 tail filename
Display the last 10 lines of a file head filename
Display the first 10 lines of a file mv oldfile newfile
Rename a file rm filename
Delete a file mkdir dirname
Create a directory rm -rf dirname
Remove a directory history
Print a history list of all commands clear
Clear the terminal shutdown -h now
Shut down the system reboot
Restart the system
Networking Linux Commands
Command Description ip addr show
Or ifconfig
List all IP addresses and network interfaces ip addr add IP-Address dev eth1
Add a temporary IP address to interface eth1 netstat -pnltu
Display all listening port whois domainname
Display more information about any domain dig domainname
Display DNS information of any domain host domainname
Perform an IP lookup for a domain dig -x IP-Address
Perform a reverse lookup of an IP address dig -x domainame
Perform a reverse lookup on domain ping host-ip
Check connectivity between two hosts
File Permission Linux Commands
Command Description ls -l filename
Check the current permission of any file chmod 777 filename
Assign full(read, write, and execute) permission to everyone chmod -R 777 dirname
Assign full permission to the directory and all sub-directories chmod 766 filename
Assign full permission to the owner, and read and write permission to group and others chmod -x filename
Remove the execution permission of any file chown username filename
Change the ownership of a file chown user:group filename
Change the owner and group ownership of a file chown -R user:group dirname
Change the owner and group ownership of the directory and all sub-directories
Linux User and Group Management Commands
Command Description w
Display all login users useradd username
Add a new user account userdel -r username
Delete a user account usermod [option] username
Change the user account information including, group, home directory, shell, expiration date usermod -aG groupname username
Add a user to a specific group groupadd groupname
Create a new group groupdel groupname
Remove a group last
Display information of the last login user id
Display UID and GID of the current user
Linux Process Management Commands
Command Description ps
Display all active processes ps -ef | grep processname
Display information of specific process top
Manage and display all processes in realtime pstree
Display processes in the tree-like diagram lsof
List all files opened by running processes kill pid
Kill a specific process using process ID killall processname
Kill all processes by name bg
Display stopped or background jobs pidof processname
Get the PID of any process
Linux Hard Drive and Storage Commands
Command Description df or df -h
See the current storage usage of mounted partitions sudo fdisk -l
See information for all attached storage devices du
See disk usage of a directory’s contents tree
View the directory structure for a path mount and umount
Mount and unmount a storage device or ISO file
Linux Disk Management Commands
Command Description fdisk -l
List all disk partitions fdisk /dev/sda
Create a new partition on /dev/sda device mkfs.ext4 /dev/sda1
Format the partition named /dev/sda1 fsck.ext4 /dev/sda1
Check and repair a filesystem for any error mount /dev/sda1 /mnt
Mount any partition to any directory df -h
Display free space of mounted file system df -i
Display free inodes on the filesystem du -hs
Display the size of your current directory lsblk
Display information about block devices lsusb -tv
Display all USB devices hdparm -tT /dev/sda
Perform a read speed test on disk /dev/sda badblocks -s /dev/sda
Test for unreadable blocks on disk /dev/sda
Linux Package Management Command
Command Description apt-get install packagename
Install the package on Debian based distributions apt-get remove packagename
Remove a package on Debian based distributions dpkg -l | grep -i installed
Get a list of all packages on Debian based distributions dpkg -i packagename.deb
Install .deb package apt-get update
Update the repository on Debian based distributions apt-get upgrade packagename
Upgrade a specific package on Debian based distributions apt-get autoremove
Remove all unwanted packages on Debian based distributions yum install packagename
Install the package on RPM-based distributions yum remove packagename
Remove a package on RPM-based distributions yum update
Update all system packages to the latest version on RPM-based distributions yum list --installed
List all installed packages on RPM-based distributions yum list --available
List all available packages on RPM-based distributions
Linux Compress and Uncompressed Commands
Command Description tar -cvf filename.tar filename
Compress a file in the Tar archive tar -xvf filename.tar
Uncompress a Tar file tar -tvf filename.tar
List the content of the Tar file tar -xvf filename.tar file1.txt
Untar a single file from Tar file tar -rvf filename.tar file2.txt
Add a file to the Tar file zip filename.zip filename
Compress a single file to a zip zip filename.zip file1.txt file2.txt file3.txt
Compress multiple files to a zip zip -u filename.zip file4.txt
Add a file to a zip file zip -d filename.zip file4.txt
Delete a file from a zip file unzip -l filename.zip
Display the content of zip archive file unzip filename.zip
Unzip a file unzip filename.zip -d /dirname
Unzip a file to a specific directory
Command Description uname -a
Output detailed information about your kernel version and architecture lsmod
Find what modules are currently loaded modinfo module_name
Get information about any particular module modprobe --remove module_name
Remove a module modprobe module_name
Load a module into the kernel
Environment Variable Commands
Command Description printenv or printenv variable_name
List all environment variables on a Linux system, or a specific one whereis and which
Find where a command in PATH is located export MY_SITE="linuxconfig.org"
Set a temporary environment variable (just an example, but use the same syntax) echo $VARIABLE
Display the value of a variable unset
Remove a variable
Command Description lspci
See general information about host bridge, VGA controller, ethernet controller, USB controller, SATA controller, etc. dmidecode
See some information about BIOS, motherboard, chassis, etc. cat /proc/cpuinfo
Retrieve processor type, socket, speed, configured flags, etc. x86info or x86info -a
See information about the CPU cat /proc/meminfo
See detailed information about system RAM lshw
List all hardware components and see their configuration details lshw -C memory -short
Detect number of RAM slots used, speed, and size hwinfo
List details for all hardware, including their device files and configuration options biosdecode
Get some general information about your system’s BIOS dmidecode -s bios-vendor
Retrieve the name of your BIOS vendor with this simple command lsusb
Get a list of USB devices plugged into your system ls -la /dev/disk/by-id/usb-*
Retrieve a list of USB device files hdparm -I /dev/sdx
Get information about your hard drive’s make, model, serial number, firmware version, and configuration hdparm -tT /dev/sdx
Show the speed of an installed hard drive – including cached reads and buffered disk reads wodim --devices
Locate CD or DVD device file
Linux Full Course
VIDEO
Related Article’s
The 7 Best Screen Recorders For Linux In 2022
How to Install Brave Browser on Kali Linux
How To Check Kali Linux Version
Advance Linux terminal commands for The Power users
Related
Needed to compose you a tiny note to finally thank you very much yet again for your personal splendid methods you have discussed above. It isstrangely open-handed with people like you to provide publicly all that a number of people would have marketed as an electronic book to generate some bucks for their own end, primarily now that you could possibly have tried it if you ever wanted. These inspiring ideas likewise acted like a fantastic way to know that the rest have the same dreams really like my personal own to see a whole lot more concerning this problem. I’m sure there are thousands of more enjoyable times in the future for many who check out your blog.black celebrity news