Wednesday, August 31, 2016

linux usual Cmds



history Command with timestamp
HISTTIMEFORMAT="%d/%m/%y %T "
history 200

grep  usage examples 
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_04_02.html

=============================
Change  root password expiry 
# chage -l root  (that is a lower case L)
# chage -I 1 -m 0 -M 99999 root
====================================================
systemctl is-active application.service
systemctl status application.service
systemctl is-enabled application.service
systemctl is-failed application.service

systemctl list-unit-files  |grep enabled
systemctl list-units --all
systemctl list-units --all --state=inactive
systemctl list-units --type=service
systemctl cat atd.service
systemctl list-dependencies sshd.service
systemctl show sshd.service
systemctl show sshd.service -p Conflicts
https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
======================================================
yum  commands  usage
http://www.thegeekstuff.com/2011/08/yum-command-examples/?utm_source=feedburner
https://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/

-------------------------------------------------------------------------------------
fuser  command 
How To View Processes Using A Directory
fuser -v /opt/cdu
displays all processes accessing filesystem on which ‘example.txt’ resides.
fuser -v -m example.txt
To list the process numbers and users of processes of a file
fuser -u  /etc/magic
To terminate all of the processes using a given file system,
fuser -k -x -u -c /dev/hd1
fuser -kxuc /home
fuser -kuc /u/home/code

To list all processes that are using a file which has been deleted from a given file system,
fuser -d /usr
What process is using your tcp or udp socket?
fuser -v -n tcp 80
Kill Processes that are Using a particular Program
fuser -v -k socket_serv
fuser -v -k -i socket_serv   -->asking permission to kill

# yum search fuser
psmisc.x86_64 : Utilities for managing processes on your system
======================================================================
To make nfs export in  linux
http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/custom-guide/nfs-export.html
NFS  /etc/exports Configuration File
https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-nfs-server-config-exports.html
to make an nfs export make entry in  /etc/exports 
/EMRBCP   cpvra00a0024(rw,no_all_squash,no_root_squash
/another/exported/directory 192.168.0.3(rw,sync)
/mnt/export speedy.redhat.com(rw)
#service nfs  restart
#exportfs   -r
#/sbin/service nfs start

Make NFS mount  in /etc/fstab
#-#  NAS nfs mount
wfsaloxnsf01.ent.com:/vol/vol90    /app/nfsdocuments    nfs   rw,bg,hard,rsize=32768,wsize=32768,vers=3,actimeo=0,nointr,nosuid,timeo=600,tcp    0 0  

Make NFS mount in command line
mount -t nfs -o ro  server_IP_addr:/share_name /local_mount_point

showmount -e   -->  to see nfs  shares of  a server

to see mounts and properties 
findmnt - find a filesyst
[root@ruvra89a0047 ~]# findmnt
TARGET                       SOURCE                  FSTYPE      OPTIONS
/                            /dev/mapper/system-root ext4        rw,relatime,barrier=1,data=ordered
â"œâ"€/proc                      proc                    proc        rw,relatime
â"‚ â"œâ"€/proc/bus/usb            /proc/bus/usb           usbfs       rw,relatime
â"‚ â""â"€/proc/sys/fs/binfmt_misc                         binfmt_misc rw,relatime
â"œâ"€/sys                       sysfs                   sysfs       rw,relatime
â"œâ"€/dev                       devtmpfs                devtmpfs    rw,relatime,size=8087064k,nr_inodes=2021766,mode=755
â"‚ â"œâ"€/dev/pts                 devpts                  devpts      rw,relatime,gid=5,mode=620,ptmxmode=000
â"‚ â""â"€/dev/shm                 tmpfs                   tmpfs       rw,relatime
â"œâ"€/boot                      /dev/sda1               ext4        rw,relatime,barrier=1,data=ordered
â""â"€/home                      /dev/mapper/system-home ext4        rw,nosuid,nodev,relatime,barrier=1,data=ordered

[root@ruvra89a0047 ~]# blkid
/dev/mapper/system-root: UUID="5574eebc-631c-438e-ad6a-27afff176519" TYPE="ext4"
/dev/sda1: UUID="c481e46c-56f3-4b69-a03c-5987fa92efcc" TYPE="ext4"
/dev/sda2: UUID="xheITH-YMkP-3otM-5jvm-859E-ekIo-JcFRpQ" TYPE="LVM2_member"
/dev/mapper/system-swap: UUID="ee7e76ca-7e72-477c-8b8f-634c0038334c" TYPE="swap"
/dev/mapper/system-home: UUID="5e7fb8b8-95fe-48fa-86f4-8302ffdc1fb6" TYPE="ext4"

# df -Ph
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/system-root       54G   11G   41G  22% /
devtmpfs                     7.8G     0  7.8G   0% /dev
tmpfs                        7.8G     0  7.8G   0% /dev/shm
tmpfs                        7.8G  137M  7.6G   2% /run
tmpfs                        7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                    488M  202M  251M  45% /boot
/dev/mapper/system-home      240M  2.2M  221M   1% /home
======================================================================









No comments:

Post a Comment