Friday, July 9, 2010

Commands-Reference

1. Create a domain name via command
/scripts/wwwacct

2. Grep / Find Command

** tail -100 /usr/local/cpanel/logs/error_log | grep -A 10 quota
The result will be the last 10 lines after 'quota'.

** # grep -R searchword * --> search for a particular word
** # find /usr/home -iname ".svn" -exec ls -lad '{}' \;
** # find /home/user/public_html/ -type f -exec sed -i 's/searchword/requiredword/g' {} \; --> This will search and replace all 'searchword' with 'requiredword' on all files for a particular directory.
** # find / -size +500M -exec ls -lh {} ';' | awk '{ print $9 ": " $5 }' --> for listing 500MB size files under / directory

3. Rsync command
for syncing source to destination for two remote server
rsync -av -e ssh /home/villages/ root@:/home/villages/

4. Tar / untar / Extraction

$ tar zxf filename.tar.gz
$ tar zxf filename.tgz
$ tar jxf filename.tar.bz2
$ tar jxf filename.tbz2

5. PASSWORD change for all users on a server
for x in `cat /etc/passwd | grep bash | cut -d":" -f1`; do echo 0182y098ya890sdy9asd | passwd --stdin $x ; done

6. How can you check your os is 32bit or 62 bit
[ajeesh@tech25 ~]$ arch
i686
[ajeesh@tech25 ~]$ which passwd
/usr/bin/passwd
[ajeesh@tech25 ~]$ file /usr/bin/passwd
/usr/bin/passwd: setuid ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

the easiest way to find out is issuing bellow the command on your Linux as well as FreeBSD
[ajeesh@tech26 ~]$ getconf LONG_BIT
32


7. dmidecode
using this command we can check full details for processor , MOB, HDD and other more hardware

[root@tech24 ajeesh]# dmidecode
# yum install dmidecode --> for install dmidecode

8. Centos verion
[root@server1 /]# cat /etc/redhat-release
CentOS release 5.2 (Final)

No comments:

Post a Comment