Tags


##Get linux distro name
$ cat /etc/*-release
$ lsb_release -a
$ cat /etc/lsb-release
=> DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
-----------------------------------------------
##Get the CPU load
$ top -b | grep "load average"
=> top - 10:46:13 up 32 days, 21:08,  5 users,  load average: 0.07, 0.12, 0.15
top - 10:46:16 up 32 days, 21:08,  5 users,  load average: 0.10, 0.13, 0.15
-----------------------------------------------
##The nproc command shows the number of processing units available:
nproc
-----------------------------------------------
lscpu gathers CPU architecture information form /proc/cpuinfon in human-read-able format:
lscpu
Compress the directory
$ tar -cvzf filename.tar.gz mydir/
-----------------------------------------------
##Uncompress the file
$ tar -xvzf filename.tar.gz
-----------------------------------------------
##To restart nginx:
sudo svc -t /service/nginx

##To stop nginx:
sudo svc -d /service/nginx

##Start nginx (if stopped):
sudo svc -u /service/nginx

##check if nginx is running:
sudo netstat -nlp | grep nginx
ps -ef | grep nginx

## To view information about password expiration you can run:
chage -l root

## To check if a running process is holding the port needed by apache open.
netstat -tap
netstat -plant or sudo lsof -i:80
top //display top CPU processes

## Show active jobs 
fg

## Kill the active jobs
kill %1

Advertisements