Dec 08

Experiment with Misc. Linux (Redhat/CentOs) Commands: Permission, kill, ps, virtualization, firwall, star, environment variables, fsck

Yes, taken from the output of the history command

ll
chmod 755 /var
w
whoami
who
id

 

With Star
star cvf /tmp/etc.tar -xattr -H=exustar /etc
cd /tmp
ls -la etc.tar
star tvf etc.tar

star tvf etc.tar
star xvf etc.tar

Attributes

lsattr etc.tar
chattr +a etc.tar
lsattr etc.tar

 

Permission Related
umask
umask -S
touch testperm
ll testperm

 

Environment Variables
echo LOGNAME
echo $LOGNAME
echo $DISPLAY
echo $SHELL
echo $HISTFILE
echo $HISTSIZE
echo $MAIL
VR1=rhel1
echo $VR1
export VR1
echo $PS1
export PS1="<$LOGNAME@'hostname':\$PWD"
export PS1="<$LOGNAME@'hostname':\$PWD>"
export PS1="<$LOGNAME@$hostname:\$PWD>"
hostnamectl set-hostname test
history 11

chattr +a etc.tar

echo ~
echo ~+
echo ~

echo ~+

 

Search words in files
grep ^root /etc/passwd
grep bash$ /etc/passwd

who | nl

Linux Processes

ps -eaf
ps -eaf | more
top
pidof crond
pidof httpd
pgrep crond
ps -U root
ps -G qemu
ps -efl

 

Priority of Processes

nice
nice top
nice -2 top
ps -el | grep top
top&
ps -el | grep top
q

 

Process in the background and foreground
fg
fg top
bg
top
renice 5 3377

Terminate Processes

top
kill -l
pkill crond
pkill httpd
kill 'pidof ftpd'
kill 'pidof vsftpd'
kill "pidof vsftpd"
pidof vsftpd

service start httpd
service restart httpd
systemctl start httpd
kill "pidof httpd"
kill 'pidof httpd'

man at
at -f ~/script1.sh now + 2 hours
yum list installed at
vi /etc/cron.allow
su root

 

Misc. Filesystems
tune2fs -l /dev/sda
tune2fs -l /dev/sda1
tune2fs -l /mnt/iso-installer
fsck
e2fsck
e2fsck /dev/sda1
e2fsck /dev/sda
e2fsck /dev/sda2
e2fsck /mnt/iso-installer
e2fsck /dev/sr0

facl : File System ACL experiment. Also, permission related

mkdir facltest
getfacl facltest
setfacl -m d:0:r facltest
getfacl facltest
setfacl -m d:o:r facltest
getfacl facltest
vi /etc/fstab
ll facltest
ll /usr/bin/su
find / - perm 4000
ls /usr/bin/wall
ls -l /usr/bin/wall
groupadd -g 9999 sdatagrp
usermod -G sdatagrp jerry
mkdir /sdata
chown root:sdatagrp /sdata -v
chmod g+s /sdata -v
ll -d /sdata
su jerry
mount /dev/sr0 /mnt/iso-installer

Experiment with rpm command
rmp -qip /mnt/iso-installer/Packages/zsh*
rpm -qip /mnt/iso-installer/Packages/zsh*
rpm -qf /etc/passwd
rpm -qR sox
rpm -qf /etc/passwd
rpm -q gpg-pubkey
rpm -Vf /etc/sysconfig/atd

Yum command Experiment

yum list install
yum list installed
yum check-update
yum history list
yum -y install gnome-packagekit

Virtualization Related

virsh
virt-install
history -l 20
history
hostnamectl set-hostname hostx.example.com

yum –y group install “virtualization hypervisor“ “virtualization client“ “virtualization platform“ “virtualization

Firewall Related

firewall-cmd --add-service=vsftpd --perm
firewall-cmd --add-service=ftp --perm
systemctl reload firewalld
systemctl start firewalld
systemctl enable firewalld
vi /etc/yum.repos.d/local.repo
yum repolist
yum install tree
ps
top
ps aux | grep yum
kill -s 9 5841
kill -s 9 6689
kill -s 9 6693
kill -s 9 6880
ps aux | grep yum
kill -s 9 6898
yum clean cache
yum repolist enabled
yum repolist all
ps aux | grep yum
kill -s 9 6915
ps aux | grep yum
pkill -9 yum
ps aux | grep yum
yum repolist
cat /etc/yum.repos.d/local.repo
yum intall tree
ps -ef | grep yum
pkill -9 yum
ps -ef | grep yum
yum repolist
ps -ef | grep yum
pkill -9 yum
/var/run/
init 3
yum repolist
yum install virt-manager*
df -h
rm -rf repodata
createrepo .
yum install virt-manager-*
systemctl start virt-manager

Install GUI virtualization Manager Tool in CentOS
yum install virt-manager*

========================Virtualization in CentOs/Redhat==============
Check if your workstation can support virtualization
lscpu | grep Virtualization
we are looking for VT-x
lscpu
we need to change bios to support vt-x. Bios probably under security
for VMWARE/Virtualbox, there is a configuration for that.

lscpu | grep Virtualization
VT-x for intel
AMD-V/RVI for amd pcs
anyway
/proc/meminfo
cat /proc/meminfo
cat /proc/meminfo | grep vmx
grep vmx /proc/meminfo
will work when you are in actual pc. I am on VMWARE
yum group info "virtualization hypervisor"

Skip to toolbar