Basic Linux Commands

Share

In this post we will go over some of the basic Linux commands I use in daily administration/troubleshooting. In this case I will be using examples in Ubuntu 24.04 LTS, so if you are using Rocky or CentOS you might find some of the commands missing.

Lets get started!

So to begin we will go over some of the commands mentioned earlier my posts:

sudo
Elevates to "super user" for more disruptive/admin heavy commands

apt-get update/upgrade/install
Used to update, upgrade, and install app and system packages

cd
Stands for "change directory", used to change the working directory

ls
Lists the current system directory and files/folders inside

vim
File editor, I prefer this one to vi or nano

Now with some of the new commands! Here I will go over some of the more helpful commands when it comes to troubleshooting and figuring out specifics in certain commands.

man
Man command stands for "manual" it can be your greatest friend when it comes to figuring out specific attributes you can use with commands, for example take IP, man tells us all the different objects we can use with it!

ip addr show
Like stated above, ip is the basic networking command, ip addr show shows is pretty much the ipconfig command related to windows

touch
The touch command supposely updates file timestamp, but can be used to create a blank file as well.

mv
Used to move and or rename files, typically when making big changes you will use this to make a .old backup and make the move.

mkdir
Makes directories, pretty much it

df -h
df shows file system usage, using the -h modifier makes it "human readable"

systemctl start/stop/restart/enable/disable ???
Usually used with the sudo commmand or as root to change systemd or service managers, usually with a new install or disabling one

su
"Switch user" used to swap to different users such as root or a more priviledge user

passwd
Changes a users password, has to be ran with elevated access

Lastly we will go over some of the less used commands!

BG/FG
Puts the current process in the background (bg) and can pull it to the forground (fg)

PS AUX
PS shows the current processes, using the attributes a,u, and x we can select all processes, sort by user list. Compareable to task manager in windows

kill
When used with PS AUX you can terminate processes by their PID

sudo ip addr add xxx.xxx.xxx.xxx/xx dev XXXX
Adds an IP to the interface, you will also need to set a route by adding a default gateway as well

cat
Reads out a specific file in a single text output

pwd
Shows "present working directory" to determine where you are

uname
Shows system name and details about the OS, specific attributes can be used to show more or less specific information

whoami
Shows the current user

rm
Removes specfic object

locate / find
Used to find location of file/text, attributes can be used to narrow and expand search restraits

grep
Usually used after a | to grab specific lines, used to find information after command

Hopefully this information can make your Linux browsing experience easier for newer users! And like I always like to say you get better the more and you'll learn more when you try to implement this into your goals, whether it will be to create a network monitoring server or log retention services!