SMBclient
To list Windows share
smbclient -U wtse -W smgtec -L x.x.x.x
To access windows share
smbclient -U wtse -W smgtec //x.x.x.x/share
To mount windows share
mount -t cifs -o user=wtse //x.x.x.x/share /mountpoint
Processes
To display a snapshot of info
pstree -p (/w PID) -a (/w command line)>/pre> To display processes
ps -U (/w particular user) u (/w detail with the current account) aux (all users)
To view processes in realtime
top (-p2644)
nice value -20 to 19, -20 is the highest priority, zero is default
To set nice value
nice -n -10 service vsftpd start ps -eo pid,nice,comm | grep vsftpd
Set the nice value on a current process
renice -n -5 2644 <--PID
To stop a process
kill PID = kill -s 15 PID (15 = clear shut down)
To kill a hang process
kill -9 PID
grep the http process owned by root user
pgrep -u root httpd
Use kill to reload the config file
kill -s 1 PID
To setup a cron job
crontab -e mm hh dd MM DOW command
cron job is saved under /var/spool/cron
all daily job is stored in /etc/cron.daily
To setup atd job (runs once only)
at -f script now+2minutes (runs the script 2 mins from now) at -f script 12pm tomorrow
To view atd job
atq or /var/spool/at
To remove atd job
atrm #
Syslogs
Syslogs config
/etc/rsyslog.conf
Kernel
dmesg to list the HW info lspci -k to list PCI info lsusb -t to view USB bus and device dmidecode -t display every HW CPU/MEM/BIOS by default lsmod to list loaded modules modinfo modulename to list the detail of a specific module modprobe -r -v modulename to remove a module modprobe modulename to load a module
To list the module in a kernel
ls /lib/modules/$(uname -r)/kernel
Boot Process
To protect grub menu
grub-md5-crypt to generate a md5 key
edit grub.conf before title
add password –md5″md5 key”
rcS.conf --> rc.sysinit --> inittab
runlevel 0 halt 1 single user mode 2 basic multi user mode (text mode, no nfs) 5 multi user GUI 6 reboot
To switch runlevel
telinit x
boot to single user mode during grub, enter 1 follow the parameter
passwd to change root password
prompt for a password in runlevel 1 by modify /etc/sysconfig/init
sulogin
Shedule a reboot
shutdown -r +5 (reboot in 5 mins)
To cancel a reboot
shutdown -c
Send notification
shutdown -h 23:00 "system will be down"
Shutdown immediately
shutdown -h now