Check certain process:
ps aux | grep <keyword>
Check what files are being used by a process:
lsof -p
Kill a process
kill -9 <pid>
Learn, write, then share
Filed in Linux System Leave a comment
Check certain process:
ps aux | grep <keyword>
Check what files are being used by a process:
lsof -p
Kill a process
kill -9 <pid>
Filed in Information Technology Leave a comment
Find any big files:
Do you maintain web server, and you worry if users trying to use your server to download movie file?
find . -size +60M
Find multiple filetypes:
find . -iname *.jpg -o -iname *.gif -o -iname *.pdf -o -iname *.png
Find then execute:
You want to search all .php files and then chmod to make them unreadable by other users?
find . -iname *.php -exec chmod 700 {} \;
Filed in Linux System Leave a comment
Prevent a package to be installed, upgraded, or removed:
aptitude install <package>=
Reconfigure broken package configuration:
It’s a handy tool if you have libapache2-mod-suphp and libapache2-mod-php installed, but you want to remove one of them, because sometimes Apache doesn’t know what you prefer; PHP or SuPHP.
dpkg-reconfigure <package>
Download a package without install:
apt-get -d install <packageName>
Filed in Linux System Leave a comment
Assume we have /dev/sda:
1. fdisk /dev/sda
2. Create a new partition: type ‘n’
3. Choose logical or primary partition: type ‘l’ or ‘p’
4. Set the size you want,
5. Write the changes you have made: type ‘w’
6. Exit from fdisk, then make a new file system, for example: mkfs -t ext4 /dev/sda3