Categories
Development

My Linux Tips

I created this post just to have a place where to keep all those linux things I always forget 😉 Hope you’ll find it useful for you as well.

Show dispatcher tasks

ps axu

Filter them by <name>

ps aux | grep <name>

Kill processes by <name>

pkill -f <name>

CPU, RAM, Disk, Network diagnostic

View all all the info using special tool: Atop (performance monitoring).
atop
filter by memory usage:
Shift+m

Filter process by PID

ps -fp <PID>

Filter processes by highest Memory or CPU usage

Memory
ps -eo pid,cmd,%mem,%cpu –sort=-%mem | head

CPU
ps -eo pid,cmd,%mem,%cpu –sort=-%cpu | head

RAM used and free, MB

free -m

 

How to change file/direcotry owner

chown -R user:group file

How to change file/directory attrubutes

chmod -R user-group-other file

where user/group/other:
7 full
6 read and write
5 read and execute
4 read only
3 write and execute
2 write only
1 execute only
0 none

How to find httpd.conf location

find / -name httpd.conf

my is in /etc/apache2/

How to restart Apache

apachectl -k graceful

How to remove a directory with all its content

rm -rf /directory

Scheduling with crontab

Schedule tasks linux using crontab

Mirroring files from other server via FTP

wget -nH –cut-dirs=3 -m ftp://user:password@ftp.website.com/a/b/c/

should be run in the rarget directory (–cut-dirs={a,b,c} count)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.