Useful Linux commands and something else

with No Comments

Shortlist of Linux commands heavily used by me

ps aux | grep tomcat - show launched tomcat processes
sudo vim server.xml - editor for file
kill -9 "0123" - kill process by id
export JAVA_HOME=/opt/develop/apps/java-for-misha - set up PATH veriables
rm -rf portal - remove dir with all inside
cp -r /usr/local/apache-tomcat-6.0.29 apache-tomcat-6.0.29_hudson  - copy with all dirs/files inside
tar -zxvf git-1.7.6.tar.gz - untar
unzip -o jenkins.war -d /opt/dev/apps/
zip -r archive papers - Copies the papers directory, including all subdirectories into the file. 
cat /etc/*release - Show CentOS version
chmod a+x "file name"  - make file executable
chown "group":"username"  -  assign permissions
vim /etc/passwd - user list
lsof -p 2707 | wc -l - how many files are opend by process 2707 du -sh - size of dir with all files in it
chown -R root:users /usr/local/apache-tomcat-6.0.29/webapps - add group 'users' to dir with subdirs
chmod -R g+rwx /usr/local/apache-tomcat-6.0.29/webapps/ - add write permissions to dir with subdirs
yum remove 'package' - remove/uninstall
rpm -ivh ImageMagick-6.7.6.rpm - install
rsync -av --ignore-existing d1/ d2/ - copy files without overwriting files
nohup ./ & - start in background s
hutdown -r now - Reboot server.
yum install mlocate - install locate command
locate jdk - find jdk home
sudo -s -H -u jenkins - change user to jenkins
unalias ls - remove directory colors
find -name met* - find file by name 'met*'
find . | xargs grep 'string' -sl - find file which contains string 'string'
netstat -anp | grep 3306 - connections to mysql
readlink -f filename - full path to filename
/etc/httpd/conf/httpd.conf - conf of apache


2) vim /etc/httpd/conf/httpd.conf and make Listen only for
3) change tomcat config: added address="" to Connector


identify -list resource - see ImageMagick used resources
export MAGICK_THREAD_LIMIT=1  - update imagemagick threads to 1 - this improve performance a lot
vim /usr/local/etc/ImageMagick/policy.xml - update threads there as well

Firefox on CentOs

export DISPLAY=:1 - set DISPLAY to :1 port

Xvfb :1 -screen 0 1024x768x24 & - Use Xvfb. It gives you an X server to doesn't connect to a physical display.So, on CentOS, you'd do something like yum install xorg-x11-server-Xvfb. You can then start it up on display :1 with the command /usr/X11R6/bin/Xvfb :1 -screen 0 1024x768x24 &. This will create a screen 1027x768 depth 24 and put the command into the background.

firefox -no-remote - start firefox


1) /etc/apache2/sites-available - create new
2) /etc/apache2/sites-enabled - put correct order

Leave a Reply