You are on page 1of 3

LINUX - CLASS - 01

by default we are in ec2-user in amazon-linux machine

to login as root user : sudo -i

here sudo : super user do

(or)

sudo su - : this is alternate command to login as root user

to logout from root user : exit

SYSTEM COMMANDS:

uname : used to get OS of our server

uname -r : used to get version of OS

uname -a : used to get full info about our OS

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

uptime -p : used to get only time

hostname : used to get private DNS name of our server

hostname -i : used to get only hostname of the server

hostnamectl set-hostname tcs-swiggy-dev : used to change hostname of a

server hostname -I : used to get private ip of the server

ip addr : used to get private ip of our server

ifconfig : used to get private ip of our server

ip route : used to get private ip of our server

last reboot : used to get when we reboot our system

date : used to get today's date

timedatectl : command used to get di erent timezones

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


cal : used to get this month calendar

cal 2023 : used to get entire year calendar

cal 08 2025 : used to get aug month calendar in 2025

date +"%d" : date

date +"%m" : month

date +"%y" : year

date +"%H" : hours

date +"%M" : minutes

date +"%S" : seconds

date +"%D" : date (mm/dd/yy)

date +"%F" : date (yyyy-mm-dd)

date +"%A" : day of the week (sun, mon)

date +"%B" : month of the year (jan, feb)

whoami : used to get, in which user currently we are logged in

who : will gets the default user of our system

HARDWARE COMMANDS:

cat : it is a command which is used to read the data in a file

cat /proc/cpuinfo : used to get cpu information

/proc : folder which contains our processor details

/cpuinfo : is a file which contains our cpu information

(or)

lscpu : used to get cpu info


cat /proc/meminfo : used to get RAM information

(or)

free : used to get RAM info in KB's free -m : used to get RAM info in MB's

df -h : used to get EBS VOLUME USAGE

fdisk -l : used to get list of volumes that are attached to our server.

You might also like