Unix Utilities


Display the number of processors:
cat /proc/cpuinfo | grep processor | wc -l

find:

find /var/log/hadoop/ -type f -mtime +3 -name “hadoop-cmf-*” -delete

find /var/log/hbase/ -type f -mtime +3 -name “hbase-cmf-*” -delete

kill
kill `ps -ef | grep flume | awk ‘{print $2}’`

mount -t nfs xyz.com:/global/dir_name /dir_name

nohup:
nohup ./bin/kibana > kibana.log &

rpm:
rpm -qa | grep TCA
rpm -e sponge-1.0.3-153299
rpm -ivh sponge-1.0.3-153299.x86_64.rpm

scp:

scp sponge-1.0.3-153299.x86_64.rpm user@vmhost:/home/mohan
scp mohan@vmhost:/home/mohan/sponge-agent-1.0.0-153299.x86_64.rpm .

setfacl:

setfacl -R -m u:functional_ID_you_want_to_give_permission:rwx your_folder_name
setfacl -R -m u:mohan:rwx /opt/sponge/workspace/redeploy.sh
setfacl -R -m u:mohan:rwx /opt/sponge/workspace
setfacl -R -m u:root:rwx /opt/sponge/workspace

touch /opt/sponge/flume-sponge.tar.gz
setfacl -R -m u:mohan:rwx /opt/sponge/flume-sponge.tar.gz
cp /home/mohan/build/dist/flume-sponge.tar.gz /opt/sponge/flume-sponge.tar.gz

setfacl -R -m u:mohan:rwx /opt/spongeui/workspace

setfacl -R -m u:mohan:rwx /opt/tomcat/apache-tomcat-7.0.35/webapps/

tar:
tar -zcvf ../sponge-flume-ng.tar.gz .
tar -zcvf ../sponge-flume-ng.tar.gz . –exclude=”jenkins”
tar -zcvf /opt/flume-agent.tar.gz .
tar -zcvf /opt/flume-agent.tar.gz . –exclude=”jenkins”

tar -zxvf /home/mohan/flume-ng-1.2.0-cdh4.1.2.tar.gz apache-flume-1.2.0-cdh4.1.2/bin apache-flume-1.2.0-cdh4.1.2/conf apache-flume-1.2.0-cdh4.1.2/lib

tar -cvf /tmp/apsconf.tar –exclude=”modules” –exclude=”logsconf” /opt/fconf/fapps/console/config/conf
tar -cvf /tmp/opsconf.tar –exclude=”modules” –exclude=”logsconf” /opt/fconf/fops/console/config/conf
tar -cvf /tmp/opsconf.tar /opt/fconf/fapps/console/config/conf

Example:
tar -zcvf /tmp/mybackup.tar.gz –exclude=’abc’ –exclude=’xyz’ /home/me

 

Advertisements