Skip to main content

Command Palette

Search for a command to run...

Linux and common commands for DevOps

Updated
3 min read
Linux and common commands for DevOps

What is Linux

Let me try to brief Linux in a few words, Linux is an operating system founded by Linus Torvald in 1991 that is widely used in DevOps because it is open-source and used by 91 percent of the applications on the internet. It allows multi-user and multi-tasking, with a powerful shell and multiple flavors like Ubuntu, Fedora, Red Hat, KALI Linux, CentOs, SUSE, Debian etc. and it is highly secured without using any anti-virus software.

Linux Architecture

Application Layer: The application layer is the first layer and this is the same as you are using any application on your Laptop and Mobile and which are connected to the hardware but there are two more layers between your application and hardware, Shell and Kernal.

Shell Layer: Shell Layer is a program that acts as an interface or doorway between a user and the kernel. It allows a user to give commands to the kernel and receive responses from it. Through a shell, we can execute programs and utilities on the kernel. Hence, at its core, a shell is a program used to execute other programs on our system just like you using your terminal in Ubuntu and shell interface in any Linux flavor OS.

Kernal Layer: Kernal layer is the heart of Linux Architecture, written in C language which directly interacts with hardware for the particular task given by the end-user on the Application Layer.

I hope now you have a clear picture of Linux and Linux Architecture.

Now Let's start with common commands

Linux Commands :

Let's start with File Commands

Here is our first command

ls

ls : This command will be listing the directory in the current location.

ls -al

ls -al : This command will show formatted listing with hidden files in the current location.

cd dir

cd dir : Change directory do dir.

cd

cd : change to home.

pwd

pwd : show current directory.

rm filename

rm filename : Delete filename file.

rm -r dir

rm -r dir : Delete directory dir recursively.

rm -f dir

rm -f dir : Delete directory forcefully.

cp fil1 file2

cp file1 file2 : Copy file1 to file2.

mv file file

mv file1 file2 : Rename file1 to file2

touch file

touch file : create of update file

cat > file

cat > file: Place standard input into the file.

head file

head file: Top 10 lines of the file will be printed.

uname

uname : It shows the name of the kernel.

clear

clear : It used for a clear screen.

whoami

whoami : Shows current login user.

history

history : List of previously used commands.

date

date : Shows date and time.

mkdir /saif

mkdir /saif : Create single saif directory.

mkdir saif ali khan

mkdir saif ali khan : Create saif,ali, khan directories.

mkdir file{1..10}

mkdir file{1..10} : Create 10 files with the given sequence.

useradd ali

useradd ali: Create user ali

grep ali/etc/passwd

grep ali/etc/passwd : To check the account properties.

passwd ali

passwd ali : To create account password.

su ali

su ali : To change the user

exit

exit : Logout user

userdel ali

userdel ali : To delete the user ali.

usermod -l devops ali

usermod -l devops ali: Change login name from devops to ali.

There are still left a lot more and will cover them in my next blog.

Happy Learning!!!

Best Regards,

Saif Ali

M

its was nice & informative. how you add copy clip option.

S
Saif Ali3y ago

Thank you , just / while writing you will get it.

1

More from this blog

Untitled Publication

22 posts