Linux Centos Basic Commands - Mani's Blog

S.NO
Linux commands
Explanation
1
top
display all the process cpu, memory utilization and cpu current avg load
2
ps -ef
display all the process name and concerned  process is
3
top -p PID
display cpu, memory utilization for the particular process and duration of live of this process
4
ps -p PID -o %cpu,%mem,cmd,etime
display cpu, memory usage for the particular process id and duration of live of this process
5
ps -C chrome -o %cpu,%mem,cmd
display cpu, memory usage for the particular process name and duration of live of this process
6
kill PID
kill the process
7
kill -3 PID
Killing the process and get the thread dump file
8
kill -9 PID
Kill the process tree
9
free -m
display RAM and swap memory usage details
10
df -h
display all the system volume storage usage
11
du -sh *
display directory and file size
12
nload
display bandwidth incoming and outgoing
13
iptraf
display bandwidth incoming and outgoing packets
14
ping destinationIP
check the connectivity between server and destination server
15
traceroute destinationIP
trace route of the destination server
16
telnet portno
to check particular port is used or not
17
netstat -tulpn | grep :port no
to check particular port is used or not
18
history
to get all the previous commands executed in terminal
19
sudo ps_mem
list the process along with memoy usage
20
split -l 100 filename prefix
split the largefile into 100 lines files
21
split -b 40kb filename prefix
split large file in to 40 Kb files
22
mkfs ext4 /dev/sdb1
make file system for new volume
23
mount /dev/sdb1 /destination_path
mount new volume to system
24
wget URL
download file from url
25
curl -O URL
download file from url
26
rpm -ivh file.rpm
offline installer command
27
yum update
update os
28
yum update software_name
update software

Tomcat  commands

1
./startup.sh
start the tomcat application
2
./shutdown.sh
shutdown the tomcat application
3
tail -f filename
runtime file watching

Apache commands

1
systemctl start httpd.service
start the apache server
2
systemctl restart httpd.service
restart papache server
3
systemctl stop httpd.service
stop apache server

mongoDB commands

1
systemctl start mongod.service
start mongodb service
2
seystemctl restart mongod.service
restart mongodb service
3
systemctlstop mongod.service
stop mongodb service
4
journalctl -xe
display the journal details for the service
5
mongodump --host ip --port 2017  -d database --out destination path
database dump command
6
mongorestore --host ip --port 27017 -d database name --dir dump file directory
restore database from backup
7
mongod --dbpath path --repair
repair database

Postgresql commands

1
systemctl start postgresql94.service
start postgresql service
2
systemctl restart postgresql94.service
restart postgresql service
3
systemctl stop postgresql94.service
stop postgresql service
4
pgdump --host ip --port 5432 --dbname=dbname --u postgres --nopassword --format plain --session pre-data --session post-data --inserts --column-insert
database dump command
5
psql -u postgres dbname <backupfile.sql
restore database from backup

Comments