16 May, 2020

Linux

liton

542 views


hostnamectl

It shows the OS name and Linux kernel version & hostname.

lscpu

It gives the CPU related informations.

free / free -h

To show the RAM details

top / htop

It show the current running processes including cpu load average & Ram usage.

ls  /  ls -l  ls -lh  /  ls -lha

To list the files and folders in the current directory.

cd  foldername  /  cd ..     cd / 

To change the current directory & to go back & to go to root directory.

touch / nano filename

To create file and edit.

mkdir foldername

To create folder.

mv

To move files and directories from directory to directory. It also allows to rename files.

rm -rf foldername

To remove forlder including all sub folders & files.

rm / unlink

To remove or delete file.

df -h

Overall disk usage status of server.

du -h --max-depth=1 | sort -h

Disk usage of single location including sub folders. Short by size.

Count all files in a directory

ls . | wc -l

check max argument: getconf ARG_MAX

Delete all files in a directory

find . -type f -exec rm -fv {} \;​
find . -type f -name 'sess_*' -exec rm -fv {} \;

also can try

find . -maxdepth 1 -name sess_* -exec rm -r {} \;
find . -maxdepth 1 -name liton* -mtime +100 -exec rm -r {} \;