Skip to main content

Command Palette

Search for a command to run...

Mastering the basic Linux commands

Updated
•2 min read•View as Markdown
Mastering the basic Linux commands
K

I'm a DevOps engineer on a journey to master the craft. I love sharing my learnings and collaborating with others in the community.

✔️uname - Display system information about the current system.

riverbyte@LAPTOP-93SCC:~$ uname

Linux

✔️sudo - allows users to execute commands with privileges that are typically reserved for the root user.

✔️Pwd - (print working directory)- prints the full path of your current working directory

riverbyte@LAPTOP-93SCC:~$ pwd

/home/riverbyte

✔️Whoami - prints the username of the current user. Returns the username of the current user session

riverbyte@LAPTOP-93SCC:~$ whoami

riverbyte

✔️Date - prints the system date.

riverbyte@LAPTOP-93SCC:~$ date

Wed Jul 24 15:08:43 IST 2024

riverbyte@LAPTOP-93SCC:~$ date +%D

07/24/24

riverbyte@LAPTOP-93SCC:~$ date +%T

15:09:17

riverbyte@LAPTOP-93SCC:~$ date +%H:%M

15:10

✔️touch - Create a file in Linux.

riverbyte@LAPTOP-93SCC:~$ touch demofile

riverbyte@LAPTOP-93SCC:~$ ls

cat cloud cloud1 demo.txt demofile document existingfile.txt file1.txtldf.zipli newfile.txt

✔️rm - It is used to remove the file.

riverbyte@LAPTOP-93SCC:~$ rm demofile

✔️vi - with the help of vi we can create a new file and edit at the same time.

riverbyte@LAPTOP-93SCC:~$ vi Demofile

riverbyte@LAPTOP-93SCC:~$ ls

Demofile cat cloud cloud1 demo.txt document existingfile.txt file1.txtldf.zipli newfile.txt

✔️cat - Read the contents of the file.

riverbyte@LAPTOP-93SCC:~$ cat Demofile

this is linux file

✔️ls - Display files and directories present in the current location

riverbyte@LAPTOP-93SCC:~$ ls

cat cloud cloud1 demo.txt document file1.txtldf.zipli newfile.txt

ls -lt provides a specific way to sort and display the contents of the directory.

riverbyte@LAPTOP-93SCC:~$ ls

cat cloud cloud1 demo.txt document file1.txtldf.zipli newfile.txt

riverbyte@LAPTOP-93SCC:~$ ls -lt

total 24

drwxr-xr-x 2 riverbyte riverbyte 4096 Jul 17 10:20 cat

drwxr-xr-x 3 riverbyte riverbyte 4096 Jul 11 11:22 cloud

-rw-r--r-- 1 ovi game 0 Jul 11 11:16 demo.txt

ls -lh - display the files & directories in human-readable format.

riverbyte@LAPTOP-93SCC:~$ ls -lh

total 24K

drwxr-xr-x 2 riverbyte riverbyte 4.0K Jul 17 10:20 cat

drwxr-xr-x 3 riverbyte riverbyte 4.0K Jul 11 11:22 cloud

-rw-r--r-- 1 ovi game 0 Jul 11 11:16 demo.txt

We will see more commands in part two!👩‍💻

More from this blog

Untitled Publication

22 posts