Joined a Linux tranning in company and share the notes, thanks.
=======class 1: mianly for basic commands=======
normal --> root
su -
root-- >other use
su - wasadmin
Linux basic commands:
cd ..
pwd
ls: show path or directory
ls -ls: details
ls -l -a: show detialsi including hidden files
mkdir <directory>
touch <file name>: create a file
rmdir <directory>
rm <file name>
copy <source file> <destination file>
Cp -rp <source diretory> <destination directory>
mv <source file/directory> <destination file/directory>: move or rename
cat <source file name>: display all content
less <source file name>: display content page by page, more page by PgUp or PgDn button
cd ~: home directory
ls .: current directly
cd ..: go to parnet directory
Echo “hello world” > /tmp/testfile
=======class 2: mainly for FS=======
three type of disks : local , SAN and NAS
1.
Command to check disks(SAN/local disk) : lsscsi
then such as dev/sr0, dev/sda, dev/sdb will be the disks.
Command to check disks size(san disk): fdisk –l /dev/sda
Command to check disks size(loal disk): lsblk (fyi: lsblk | tail -5)
Command to check disks size(nas disk): df –h ( AIX : df –g)
2.
Create a filesystem and mount(command runing within root):
comamnd: pvcreate /dev/sdb3 -----> create physical volumn
vgcreate vg03 /dev/sdb3 -----> create volumn group
lvcreate -L 1G -n lv_test vg03 -----> create logic volumn
create FS: mkfs.ext4 /dev/mapper/vg03-lv_test
mount: mount /dev/mapper/vg03-lv_test /usr/tmp/higirlbehappy
3.
verify/view command(need run within root):
-vgs
-lvs
-pgs
4.
umount the FS(or mountpoint):umount /var/tmp/higirlbehappy
verify comamnd: df /var/tmp/higirlbehappy
remove logic volume command:lvremove
verify command: lvs
=======class 3: mianly for persmission=======
edit file in AIX: command vi, such as vi test.txt/touch test.txt
edit file in AIX: command nano, such as nano test.txt/touch test.txt(save file: ctrl+o, exit: ctrl + x)
how to check a user: id userid
check all the accounts: cat /ect/passwd
check all the groups: cat/etc/group cat /etc/group | grep cmbitid
change the owner of file/folder
command: chown <user.group> <file/folder>
command sample: chown cmbitid.loggrp test
change the permisson fo file/folder:
command: chmod <u/g/o> <+/-r/w/x> <file/folder>
command sample: chmod u+x,o+r test
command sample: chmod u-wx, g-r,o-r test or chmod 755 folder
r(4)w(2)x(1)
Users : rwx = 4+2+1 = 7
Groups : r-x = 4+1 = 5
Others : --- = 0
What is /etc/fstab file ?
The fstab file is read by the mount command, which happens automatically at boot time to determine the overall file system
structure
The NAS filesystem will NOT mount after reboot!
How to add an NAS filesystem entry into /etc/fstab ?
Vi /etc/fstab
Edit file , add the line to bottom <NAS volume> <directory / mount point> nfs default 0 0
Save the /etc/fstab
Run the command “mount”