Linux_Learning_Notes-1

###vncviewer###
  a. vncviewer -shared -viewonly 192.168.0.254:1
   a1. '-shared' - means share session with others
   a2. '-viewonly' - can not control only view
  b. vncviewer -shared -viewonly 192.168.0.254:1 -passwd /etc/vncpasswd
   b1. use 'vncserver create a passwd file in ~/.vnc/passwd, copy to /etc/vncpasswd


###/etc/yum.repos/*###
[Server]
name=LocalServer
baseurl=file:///mnt/server
gpgcheck=0

[Cluster]
name=Cluster
baseurl=ftp://192.168.0.254/pub/5.4/cluster
gpgcheck=0
enable=0



###Package Management with RPM###
Features:
 1. Compression of packages
 2. SHA-256 hashes are used to sign packages
 3. RPM DB: '/var/lib/rpm' - tracks installed packages, attributes of package file, etc.
 4. 5-Modes of operations:
  a. Install
  b. Uninstall
  c. Upgrade
  d. Query
  e. Verify
 5. Caveat: Does NOT auto-resolve dependencies: Use 'yum'
 6. Caveat: RPM does NOT track non-RPM programs/apps: i.e. '*.tar.gz' || '*.tar.bz2'

Tasks:
 1. Query
  a. 'rpm -qa' - dumps ALL installed packages (RPMs)
  b. 'rpm -qa | grep grep' - 'grep-2.6.3-2.el6.x86_64'
	'grep' - main name of package
	'2.6.3-2' - package version
	'el6.x86_64' - RedHat Version & Platform
  c. 'rpm -qi grep' - returns metadata about 'grep' package
  d. 'rpm -ql grep' - enumerates the contents of the package: 'grep'
  e. 'rpm -qf /bin/grep' - enumerates the file's package membership
  f. 'rpm -qd grep' - enumerates the included documentation
  g. 'rpm -qc lftp' - enumerates a package's configuration file(s)
  h. 'rpm -qpi unix2dos-2.2-35.el6.x86_64.rpm

 3. Verify - Verifies file system contents against installed package in RPM DB
Note: Returns: '.' per test performed if the test passed
Note: If test fails, one of the following will be returned:
5(MD5), S(file size), L(symlink), T(mod time), D(device), m(mode), ?(unreadable file), U(user), G(group)

  a. 'rpm -Vvf /bin/grep' - compares: /bin/grep to 'grep' RPM
  b. 'mv /bin/grep /bin/grep.original && touch /bin/grep'
SM5....T.	/bin/grep

 3. Install - Works if package does NOT exist on the system
  a. 'rpm -ivh unix2dos-2.2-35.el6.x86_64.rpm

 4. Upgrade - Install and/or Upgrades
  a. 'rpm -Uvh unix2dos-2.2-35.el6.x86_64.rpm' 
  b. 'rpm -Uvh --replacepkgs unix2dos-2.2-35.el6.x86_64.rpm

 5. Uninstall
  a. 'rpm -e grep' - checks dependencies and warns where appropriate 

 6. Import RedHat RPM GPG Key to confirm package signatures:
  a. 'rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release'
  b. 'rpm -qa gpg-pubkey*'


###find###
 1. find / -mtime +3 - three days ago
 2. find / -mtime -3 - within three days
 3. find / -newer a.txt

ypcat -d <NIS> -h <DNS> passwd
ypcat -d <NIS> -h <DNS> shadow

yum whatprovides filename

su [-] user - the '-' option makes the new shell a login shell

e2label /dev/sda1 
blkid /dev/sda1 - show UUID and TYPE
dumpe2fs /dev/sda1

dd < /dev/sda > mbr bs=512 count=1

default options: rw, suid, dev, exec, acl, async, fuser

cryptsetup crypt partition

Linux LVM (0x8e)

lvreduce -L -100M /dev/vgsrv/home

mount -o remount,rw /

nice -20 - 19

man -k passwd
 1 User Commands
 2. System Calls
 3. C Library Functions
 4. Devices and Special Files
 5. File Formats and Conventions
 6. Game et. Al.
 7. Miscellanea
 8. System Administration tools and Deamons

man 5 shadow
 1. login name
 2. encrypted password
 3. date of last password change
 4. minimum password age
 5. maximum password age
 6. password warning period
 7. password inactivity period
 8. account expiration date
 9. reserved field

'ln -s' MUST use absolute path

'cp -p' keep the owner and mtime

'mkdir -p a/b/c/d
'\rm' do not run alias
'rmdir -p'
'updatedb'

'rsync src dest'
'rsync -r src dest' - sync dir
'rsync -r /etc/ .' - /etc/ == /etc/* - not include '/etc'
'rsync -a src dest' - '-a' == '-rlptgoD'
'rsync -z src dest' - compress

'yum provides */scp'

SSH Auto Login
 1. ssh-keygen
  a. id_rsa - key
  b. id_rsa.pub - lock
 2. ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
 3. ssh-agent bash
 4. ssh-add


vncserver -kill :2
vncpasswd

setfacl
getfacl

PasswordAuthEntication yes

file-roller

tar zcf etc.tar.gz /etc
tar jcf etc.tar.bz2 /etc

http://localhost/manual

/etc/motd


/etc/ssh/sshd_conf
AllowUsers student
PasswordAuthentication no
PermitRootLogin no

wireshark
ip.addr==192.168.0.23

/etc/sysconfig/vncservers

vncviewer -via whx@localhost localhost:2

tune2fs -l /dev/sda1
tune2fs -L boot /dev/sd1
tune2fs -o acl /dev/sda3

swapon -s


dd if=/dev/zero of=/tmp/swapfile bs=1024k count=100
mkswap /tmp/swapfile
swapon /tmp/swapfile
update /etc/fstab file
/tmp/swapfile swap swap defaults 0 0

AMD - svm
Intel - vmx
lm - support 64-bit

/etc/resolv.conf
nameserver 192.168.0.254

echo westos | passwd --stdin root

Disable -> Enforcing - need reboot
Disable -> Permissive - need reboot
Enforcing <-> Permissive - don't need reboot


grub> root (hd0,0)
grub> kernel /vmlinuz-[TAB] ro root=/dev/mapper/vfsrv-root
grub> initrd /initramfs[TAB]
grub> boot

restorecon -R dir

Kernel-Parameters
yum -y install kernel-doc

console=ttyS0
enforcing=0|1 (0 - Permissive, 1 - Enforcing)
selinux=1|1 (0 - disable, 1 - enable)
init=/bin/bash

pvcreate /dev/sda5
vgextent vol0 /dev/sda5
lvextent -L 30G /dev/vol0/root
resize2fs /dev/vol0/root

GRUP - press A

setenforce 0|1
getenforce

vsftp - /var/ftp

Google  [ index /pub ]
Google  [ nagios site:www.ibm.com ]


if boot is a sym link
'rm -rf boot/' can not delete it

你可能感兴趣的:(linux)