How to see Linux version or type?
1.cat /etc/issue
Welcome to SUSE Linux Enterprise Server 11 (x86_64) - Kernel \r (\l).
2./etc/redhat-release
3.cat /etc/*release
ISA of an UNIX machine?(How to see OS bit level ?)
1)// Solaris ---- isainfo -v
2) // for hpux and linux ----- getconf WORD_BIT
3) // for AIX ----- getconf –a | grep KERNEL_BITS (or) getconf KERNEL_BITMODE
4) bootinfo -K
5)//HP-UX - ----- getconf KERNEL_BITS
32 bit or 64 bit??(How do we know the BIT level of Processor - Hardware?)
AIX ------- bootinfo -K getconf LONG_BIT (or) getconf HARDWARE_BITMODE
SOLARIS ------ isainfo -b
HPUX ------- getconf KERNEL_BITS
LINUX --------- getconf LONG_BIT
How to see RAM usage?
Solaris : To see RAM : /usr/sbin/prtconf
To see free ram : vmstat
Linux : free -m [ or ] top [or] # cat /proc/meminfo
memory size in MB(memory is RAM size)
And Swap is SWAP size
HP-Ux : /usr/contrib/bin/machinfo.
To see HD space in HP UX
For disk info, use ioscan -fnkC disk command then diskinfo command will give you info about each disk.
How to work with back space and options in HP-UX ?
Option 1: Use bash_hp binary
Option 2: stty -a
intr='^c'
stty intr '^c'
Option 3 :
Run the following in command line
exec stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z"
How to add new user ?
Solaris9
bash-3.00# useradd -d /export/home/kbabu -s /bin/ksh -m kbabu
64 blocks
bash-3.00# passwd kbabu
New Password:
Re-enter new Password:
passwd: password successfully changed for kbabu
How to delete a user in Solaris 9 ?
The userdel(1M) command is used to delete a user account. The user account is specified as a command-line argument. Only one other command-line argument is supported. This is -r, which is used to remove the home directory. The following shows deleting the user3 account:
# userdel -r user3
AIX
mkuser "pgrp=mysql" "groups=mysql" "shell=/usr/bin/ksh" "home=/opt/mysql" mysql
home dir == /opt/mysql
How to modify or create a user?
user kbabu
usermod
Command to show type of UNIX flavor?
uname –a
How to see the logged in user?
1>>$LOGNAME
2>>id
How to see running processes?
1>> top
2>> monitor
3>> prstat
How to see Virtual memory usage?
vmstat
How to enable FTP on Solaris 10?
inetadm -e ftp
svcadm enable ftp
How to use Back space in AIX?
Shift + Backspace
How to send broad cast message to all current users of the machine?
wall hi
How to start FTP on LINUX?
Edit the file /etc/xinetd.d/wu-ftpd
changing the two lines to:
default: on
disabled = no
then run the command
etc/rc.d/init.d/xinetd restart
on RH linux AS4
# /etc/init.d/vsftpd start
Starting vsftpd for vsftpd: [ OK ]
how to give ftp for root
Configure FTP for root logins
Edit the files /etc/vsftpd.ftpusers and /etc/vsftpd.user_list and remove the 'root' line from each file.
How to enable telnet?
Edit the file /etc/xinetd.d/telnetd
changing the two lines to:
# default: on
disabled = no
then try doing this
/etc/rc.d/init.d/xinetd restart
cat /etc/passwd
vi /etc/vsftpd/ftpusers
vi /etc/vsftpd/user_list
vi /etc/vsftpd/vsftpd.conf
service vsftpd reload
How to set current working directory at your prompt?
PS1='\w $'
How to see patch level of the OS (solaris) ?
showrev -a
showrev -a | tee /opt/kbabu/a.txt
How to use SCP? (Secure Copy)
scp user@hsot1 a.txt user@host2:/osdb/jkdj/
How to made HP-UX easy?
exec stty erase "^H" kill "^U" intr "^C" eof "^D" susp "^Z"
How to see common entries in two files?
sort file1 file2 | uniq –d
How to mount files in Solaris 10?
mount -F nfs -o vers=3 172.22.21.2:/StarTeam /StarTeam
-----------
Mount –F/t nfs 172.22.21.2:/StarTeam /StarTeam
Sol: vi /etc/vfstab
172.22.21.2:/StarTeam - /StarTeam nfs - yes rw,hard
Li: vi /etc/fstab
172.22.21.2:/StarTeam - /StarTeam nfs - yes rw,hard
How to see IP from a host name or Host name from IP?
/usr/sbin/nslookup mercury
Server: 9.20.136.11
Address: 9.20.136.11#53
Name: mercury.hursley.ibm.com
Address: 9.180.210.217
Installing top?
pkgadd -d top-3.6.1-sol10-sparc-local
How to create NFS Sharing?
To be able to share a remote filesystem you have to share the remote filesystem.
To share the remote filesystem you need to modify
the /etc/dfs/dfstab file with
share -F nfs -o rw /filesystem
also modify the /etc/dfs/sharetab with
/filesystem nfs rw
then issue
shareall
make sure nfs daemon are running of the server
you could check by isseing
ps -ef | grep nfs
if it is not running you could start nfsd by issuing /etc/init.d/nfs.server start
on the client side, that is the side with no disk space
you need to mount the remote filesystem you could do this by issuing
mount (remote server):/usr/local /mount_point
Note:
/filesystem will be the filesytem you intend to share eg / /usr/local, /var, /export/home
so if you intend to share /usr/local your /etc/dfs/dfstab will look like
share -F nfs -o rw /usr/local
and /etc/dfs/sharetab will look like
/usr/local - nfs rw
How to add route between machines ?
To discover the Southbank Test Network you may need to add suitable routes:
A discovery from Hursley requires a route to 172.20.0.0/16 and 172.21.0.0/16 via 9.180.210.193
Note on Routing table on devtest22
A discovery from Southbank requires a route to 172.20.0.0/16 and 172.21.0.0/16 via 9.196.131.10
IP Route command examples would be:
Linux:
ip route add 172.20.0.0/16 via 9.196.131.10
Solaris:
route add 172.20.0.0/16 9.196.131.10
Windows:
route add 172.20.0.0 mask 255.255.0.0 9.196.131.10
netstat -r
route add 10.100.20.1/24 172.22.23.43
add all the agetns of range 1-24 to the gateway with the server 43
route add 10.100.20.1 172.22.23.43
How to zip a folder in UNIX using tar ?
tar -cvf netcool.tar netcool/
gzip netcool.tar
or
tar -cvzf filename.tar.gz folder-name
How to run gunzip and tar at a time ?
gunzip -c C1H53EN.tar.gz | tar xf -
tar -xvfz file.tar.gz
How to get PID of a used port ?
AIX : for i in `ps -e|awk '{print $1}'`;do echo "UR PID :$i" ;procfiles $i |grep 1521;done
Solaris :
for i in `ps -e|awk '{print $1}'`;do echo "UR PID :$i" ;pfiles $i |grep
ex :
for i in `ps -e|awk '{print $1}'`;do echo "UR PID :$i" ;pfiles $i |grep 1521;done
Solaris 2.9 AIX 5.2
pflags [-r] [pid | core] procflags [-r] [pid]
pcred [pid | core] proccred [pid]
pmap [-rxIF] [pid | core] procmap [-F] [pid]
pldd [-F] [pid | core] procldd [-F] [pid]
pstack [-F] [pid | core] procstack [-F] [pid]
pfiles [-F] [pid] procfiles [-nF] [pid]
ptime command [argument] Not available
How to see the folder occupied space on the disk ?
du -sh /opt/kbabu
How to know the last rebooted time of a solaris server ?
bash-2.05$ uptime
7:18am up 47 day(s), 23:50, 4 users, load average: 0.36, 0.56, 0.35
What is UMASK ?
UMASK is a Unix environment variable which automatically sets file permissions on newly created files.
The UMASK variable can be confusing to use, because it does work as a mask. In other words, you set the permissions that you do not want in the UMASK.
To calculate permissions which will result from specific UMASK values, subtract the UMASK from 666 for files and from 777 for directories.
If you want all files created with permissions of 666, set your UMASK to 000. Alternatively, if you want all files created with permissions of 000, set your UMASK to 666.
A reasonable value for UMASK is 022, which will cause files to be created with permissions of 644 (rw-r--r--) and directories to be created with permissions of 755 (rwxr-xr-x).
A more secure value for UMASK is 066, which will cause files to be created with permissions of 600 (rw-------) and directories to be created with permissions of 700 (rwx------).
UMASK is nomally defined in the .profile or .login user startup files.
usage :
bash-2.05$ umask
022
bash-2.05$ umask 077
How to extract cpio file in UNIX ?
cpio -idmv <>
IPV6
How to check the whether IPV6 is configured on Linux machine or not ?
[ -f /proc/net/if_inet6 ] && echo 'IPv6 ready system!' || echo 'No IPv6'
simply if we see "/sbin/ipconfig -a" output we will see some thing related IPV6 which itself confirms the IPV6 configuration
How to put process running on foreground to background and viceversa?
You have a process running on Unix terminal as follows ..
bash$./launchpad
to put it in back ground
hold ctrl+ z
It will be stopped and kept in stopped jobs
If u see jobs u can see that in stopped jobs list say
to bring it back to foreground
command : fg %1
assuming in the jobs list our job no is 1.




2 comments:
It's really useful ..thanks for sharing
what is sticky bit?
Post a Comment