Skip to main content

Command Palette

Search for a command to run...

Linux commands for daily use

Updated
4 min read

Before learning the command let’s learn what is OS (operating system)

What is OS:

An Operating System (OS) is a software that acts as an interface between computer hardware components and the user. Every computer system must have at least one operating system to run other programs. Applications like Browsers, MS Office, Notepad Games, etc., need some environment to run and perform its tasks.

LINUX:

Linux is a free and Open-source operating system with high security. Linux is multiuser based OS.

Why we use Linux as OS:

Because of the below key features which comes along with Linux operating system.

key features Linux:

  1. Linux is open source, meaning it is available at no cost, allowing you to use it freely.

  2. It is more secure in nature.

  3. It contains lot of distributions.

  4. It is fast running operating system.

  5. It has multiuser and multitasking capabilities.

LINUX OS DISTRIBUTIONS:

Many of the users taken the Linux OS and modified according to their requirements and released into the market with different names called Linux distribution.

  • RedHat

  • Ubuntu

  • Debian

  • Centos

  • Fedora

  • Opensuse

  • Kali

  • Linux

  • Amazon Linux

  • Rocky Linux

HISTORY:

On Sep 17th 1991, Linus Torvalds a student at the university of Helsinki, Finland, He released the first version of the Linux kernel, known as Linux 0.01, as open-source software.

  • The Linux kernel is written in C language.

  • He wrote this program specially for his own PC

  • Firstly he wanted to name it as 'Freax' but later it became 'Linux'.

  • In 1992, he released the kernel under GNU General Public License.

  • Today, supercomputers, smart phones, desktop, web servers, tablet, laptops and home appliances like washing machines, DVD players, routers, modems, cars, refrigerators, etc use Linux OS.

Architecture:

KERNEL:

It is the core or the heart of the operating system. It's the central part that manages and facilitates communication between the computer's hardware and software.

SHELL:

A shell that allows users to interact with the operating system. There are two types of shells. Command Line Interface (CLI):

  • Executes the command provided by the user in the form of a command and displays the output in the terminal.

  • Executes the process provided by the user in a graphical way and displays the output in the graphical window.

COMMAND:

  • It is an instruction/request given to the operating system by a user.

  • It tells the computer to perform a particular task.

TERMINAL:

  • It is a text-based interface that allows you to interact with the operating system by typing commands.

  • It's a way for you to communicate with the Linux machines.

LET’S DIVE INTO PRACTICAL SESSION:

By default, we are in ec2-user, but if we want to perform any action, we should be in root user

because, root is the ultimate king of Linux, root has full permissions, so that we can run any command anywhere.

To login as root user: sudo -i

Here sudo : super user do

to logout from root user and go back to ec2-user: exit

In Linux we have different types of commands

  • SYSTEM COMMANDS

  • HARDWARE COMMANDS

  • FILE COMMANDS

  • PERMISSION COMMANDS

  • USER COMMANDS

  • SEARCH COMMANDS

  • NETWORKING COMMANDS

SYSTEM COMMANDS: Used to get system information

uname : used to get type of OS

uname -r: used to get kernel version of our OS

uname -a: used to get full info about OS

clear: this command is used to clear the clear (or) you can use ctrl + l as a short cut

uptime: used to get since how long our system is in running state

uptime -p: this will give only time

hostname: used to get private dns name of our system

hostname -i : used to get private Ip of our system

hostnamectl set-hostname “swiggy”: used to change hostname

Ip addr : used to get private IP

Ip route: used to get private IP

ipconfig: used to get private IP

date: to get todays date

timedatectl : used to get timezones

timedatectl set-timezone Asia/Kolkata: used to change Time zone to IST

who: used to see how many users have been login into your system

whoami : used to see the current user.

SOME EXTRA COMMANDS FOR PRACTICE:

date +” %d”: used to get only date

date +” %m”: used to get only month

date +” %y”: to get only year

date +” %H”: used to get Hours

date +” %M”: used to get Minutes

date +” %S”: used to get seconds

date +” %D”: it will return todays full date (02/01/24) FORMAT: mm/dd/yy

date +” %F”: it will return todays full date (2024-02-01) FORMAT: yyyy-mm-dd

date +” %A”: used to get day of a week date +” %B”: used to get month of a year