Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BASIC COMMANDS
- $ ls
- $ mkdir Nktt
- $ cd Nktt
- $ mkdir BBI
- $ mkdir BCOM
- $ mkdir BSCIT
- $ ls -a
- $ ls -l
- $ cd BBI
- $ cat >> FY ADD DATA THEN CTRL + Z
- $ cat >> SY ADD DATA THEN CTRL + Z
- $ cat >> TY ADD DATA THEN CTRL + Z
- $ cd ..
- $ cd BCOM
- $ cat >> FY ADD DATA THEN CTRL + Z
- $ cat >> SY ADD DATA THEN CTRL + Z
- $ cat >> TY ADD DATA THEN CTRL + Z
- $ cd ..
- $ cd BSCIT
- $ cat >> FY ADD DATA THEN CTRL + Z
- $ cat >> SY ADD DATA THEN CTRL + Z
- $ cat >> TY ADD DATA THEN CTRL + Z
- $ ls -a
- $ ls -l
- $ ls -F
- $ ls -r
- $ ls -R
- $ ls -S
- $ ls *
- $ ls
- ---------- TOUCH USE KARNE KE LIYE
- $ mkdir nktt1
- $ cd nktt1
- $ touch f1 f2 f3 f4
- $ ls -l
- $ cd
- $ cd nkkt1
- $ ls
- $ rm f1
- $ rm -rf f2
- $rm -v f3
- $ ls
- $ rm -l f4
- $ ls -l
- $ cd
- $ rmdir nktt1
- $ ls
- $ mkdir nktt2
- $ cd nktt2
- $ pwd
- $ cat >> collegegroup ADD DATA THEN Ctrl + z
- $ cat collegegroup
- $ tac collegegroup
- $ head collegegroup
- $ tail collegegroup
- $ more collegegroup
- $ less collegegroup
- $ man collegegroup
- $ date
- $ cal
- $ who
- ----------------------------------------------------------ADVANCE COMMAND
- $ ps a
- $ ps u
- $ ps x
- $ ps aux | less
- $ ps aux | tail
- $ ps afx
- $ ps aux
- $ ps aux >> p1.txt
- $ ls
- $ find *p1.txt
- $ grep "Words_to_be_searched" f5
- $ jobs
- $ gb
- $ fg
- $ top
- $ Pstree
- ---------------------------------------------------------------------------------------------------------------------------
- SOFT LINK
- $ mkdir nktt3
- $ mkdir softlink
- $ cd nktt3
- $ mkdir f5
- $ cd f5
- $ mkdir f6
- $ cd f6
- $ cat >> test1
- Hello
- i am fine (ctrl + z)
- $ pwd (COPY PATH)
- $ cd
- $ cd softlink
- $ ln -s (PASTE THAT COIED PATH + /test soft)
- $ ls -ltr
- $ cat soft
- --------------------------------------------------
- HARD LINK
- $ mkdir nktt4
- $ mkdir hardlink
- $ cd nktt4
- $ mkdir f7
- $ cd f7
- $ mkdir f8
- $ cd f8
- $ cat >> test2
- Hello
- i am fine (ctrl + z)
- $ pwd (COPY PATH)
- $ cd
- $ cd hardlink
- $ ln -s (PASTE THAT COIED PATH + /test hard)
- $ ls -ltr
- $ cat hard
- --------------------------------------------------------------------------------------------------------------------------
- CHANGE IP ADDRESS
- 1) CLI
- $ su
- $ ifconfig eth1
- $ ifconfig eth0 192.168.0.1 netmask 255.255.255.0
- $ ifconfig eth1
- 2) GUI
- $ su
- $ system-config-network
- SELECT DEVICE CONFIGURATION
- SELECT AUTO ETH1
- ENTER YOUR INFORMATION IN NETWORK CONFIGURATION
- CLICK ON SAVE AND QUIT
- $ service network restart
- $ ifconfig
- 3) NETWORK SCIPT
- $ su
- $ vi /etc/sysconfig/network-scripts/ifcfg-eth0
- TYPE=Ethernet
- BOOTPROTO=none
- IPADDR=192.168.0.4
- NETMASK=255.255.255.0
- OR OR OR OR
- TYPE=Ethernet
- BOOTPROTO=none
- DEFROUTE=yes
- IPV4 FAILURE FATAL=yes
- IPV6INIT=no
- NAME="Auto eth1"
- UUID=c79f9b2d-d556-4f9c-82fe-da85155209eb
- ONBOOT=yes
- DEVICE Auto eth1
- NM CONTROLLED=yes
- USERCTL=no
- HWADDR=08:00:27 a3: be:84
- PEERDNS=yes
- PEERROUTES=yes
- LAST CONNECT-1697002323
- IPADDR=198.168.0.1
- NETMASK=255.255.255.0
- $ vi /etc/sysconfig/network-scripts/ifcfg-eth0
- TYPE=Ethernet
- BOOTPROTO=none
- DEFROUTE=yes
- IPV4 FAILURE FATAL=yes
- IPV6INIT=no
- NAME="Auto eth1"
- UUID=c79f9b2d-d556-4f9c-82f0-da85155209eb
- ONBOOT=yes
- DEVICE=Auto eth1
- NM_CONTROLLED=yes
- USERCTL=no
- HWADDR=08:00:27:33:be:84
- PEERDNS=yes
- PEERROUTES=yes
- LAST CONNECT=1697002323
- IPADDR=198.168.0.4
- NETMASK=255.255.255.0
- $ service network start
- $ ifcfg
- --------------------------------------------------------------------------------------------------------------------------
- USER ADD MODIFICATION DELETION
- $ su
- $ useradd user1
- $ passwd user1
- $ su user1
- $ pwd
- GO TO ORIGINAL USER
- $ su user
- $ useradd user2
- $ usermod -l user2 user3
- $ usermod -d /new/home/directory user3
- $ userdel user3
- CREATE A GROUP:
- # groupadd users
- DELETE A GROUP:
- # groupdel users
- ADD USER TO A GROUP:
- # usermod -a G users user2
- REMOVE USER FROM A GROUP:
- # usermod -G - user2
- $ id user2
- $ gid=502(user2) groups=502(user2)
- $ usermod -m -d /home/user2 user1
- $ su user1
- $ pwd
- $ su user1
- $ usermod -e 2023-07-20 user1
- GO TO PROPERTIES - ACCOUNT INFO
- $ usermod -g m1 user1
- $ id user1
- $ usermod -L user1
- $ usermod -U user1
- $ userdel -r user1
- ---------------------------------------------------------------------------------------------------------------------
- NFS
- $ su -
- $ rpm -qa | grep nfs
- $ cd /
- $ cd home
- $ ls
- $ mkdir test1
- $ cd test1
- $ touch f1 f2 f3
- $ cat >> s1
- Hello World
- $ vi /etc/exports
- Insert this line :
- /home/test *(rw,sync)
- and then press:
- (esc) : w q
- (enter)
- $ service nfs start
- $ ifconfig
- $ showmount -e 192.168.87.172 //your ip address
- $ service iptables stop
- $ service iptables status
- $ chmod -R 777 /home/test1
- $ cd ..
- $ pwd
- $ ls
- $ mkdir nfsclient
- $ mount -t nfs 192.168.87.172:/home/test1 /home/nfsclient
- $ cd nfsclient
- $ ls -l
- $ ls -a
- -------------------------------------------------------------------------------------------------------------------
- SAMBA
- In latest windows 10 and 11 by default SMB 1.0 is disabled and SMB client version 4 is not supported in rhel 6
- To Enable it :
- 1. Press start button and search turn windows features on or off
- 2. Enable this SMB 1.0 as sh\own in figure
- 3. Restart the pc
- $rpm -q samba samba-common samba-client
- $rpm -qa | grep samba
- If not installed then install using
- $yum install samba
- 3. $su -
- 4. $cd /
- 5. $mkdir myshare
- 6. cd /myshare
- 7. $touch file1
- [myshare]
- comment = any comment
- path = /myshare
- writable = yes
- browseable = yes
- $vi /etc/samba/smb.conf
- $testparm //to check syntactical errors
- $setsebool -P samba_export_all_rw on
- $setsebool -P samba_enable_home_dirs on
- $ls -ldZ /myshare //It will display default_t label which needs to be set to samba_share to enable edting system files
- $chcon -t samba_share_t /myshare
- $service iptables stop
- $useradd test
- $smbpasswd -a test
- Password 123
- $service smb start
- $service nmb start //To use hostname instead of ip addresses nmb package is used
- $smbclient -U test -L localhost //to check details of share
- $ip addr show or $hostname //make sure internet is connected check eth ip address
- Now open cmd in windows os to test connection between rhel and windows
- In windows cmd
- Ping your rhel ip address or hostname to verify connection
- $ping 192.168.31.172 OR //if packets sent 4 and received 4 then successful connection is established
- $ping mylinuxpc //if packets sent 4 and received 4 then successful connection is established Here mylinux pc is hostname of rhel
- Open windows explorer and right click network and click map network drive In folder textbox enter rhel server ip address
- e,g \\192.168.31.172\myshare
- OR
- e,g \\mylinuxpc\myshare
- Enter username and password
- Username test
- Password 123
- ----------------------------------------------------------------------------------------------------------------------
- FTP
- $yum install vsftpd (press y and enter whenever prompted)
- $yum install ftp (press y and enter whenever prompted)
- su -
- rpm -qa | grep vsftpd
- Service vsftpd start
- Service vsftpd restart
- Service vsftpd status
- Service iptables stop
- Service iptables status
- Setsebool ftp_home_dir=1
- Getsebool -a | grep ftp
- Useradd test
- Passwd test
- Ls -idZ /var/ftp/pub
- Chgrp ftp /var/ftp/pub
- Chown ftp /vfar/ftp/pub
- $Cd /var/ftp/pub
- $Touch a1 a2 a3
- Cat >> f1
- Hello world
- Cd /
- Ifconfig
- ftp 192.168.71.172 (add ip of ur linux sys)
- Enter username and password
- Login Successful
- ----------------------------------------------------------------------------------------------------------------------
- APACHE
- SU
- # rpm -qa | grep httpd
- 2. # chkconfig httpd on
- 3. # service httpd start
- 4. # service httpd restart
- 5. # cd /var/www/html
- <!DOCTYPE html>
- <title>Simple HTML Page</title>
- <head>
- </head>
- <h1> Hello World </h1>
- <body>
- </body>
- </html>
- 6. # vim test.html
- 7. Esc : wq
- 8. Open Firefox browser and enter url
- http://localhost/test.html
- SSI METHOD
- r #su -
- #ifconfig
- 2. #dig (Your_IP_Address)
- e,g #dig 192.168.1.3
- 3. #vim /etc/httpd/conf/httpd.conf
- 1. NameVirtualHost *:80
- 2. <VirtualHost *:80>
- 3. DocumentRoot
- 4. </VirtualHost>
- 4. Go to the last (pgDown Button) and uncomment(remove #) the following
- 5. Change the path of Document Root to /var/www/html
- 6. Now press pg up button and find this line upside line no. 339 and change Directory path to /var/www/html and add Includes after indexes
- 7.
- 8. Esc :wq
- 9. #service httpd restart
- 10. To resolve any warning Uncomment servername in line 273
- 11. Esc:wq
- Practical 8b: Apache SSI (Server Side Includes)
- Pracs Page 15
- 12. #chkconfig httpd on
- 13. #cd /var/www/html
- 14. #chmod -R 777 /var/www/html
- 15. #vim sitest.shtml (Any Name with extension .shtml)
- Enter the code
- <!DOCTYPE html>
- <html>
- <head>
- <title>SSI Test Page</title>
- </head>
- <body>
- SSI Test Page Output
- <hr>
- <p align="center">
- This file was last modified on :
- <!--#echo var="LAST_MODIFIED" -->
- </p>
- </body>
- </html>
- 16. Esc :wq
- 17. Now open firefox browser and enter http://localhost/sitest.shtml (Your filename with extension)
- PDH METHOD
- In /var/www/html dir
- 1. # vim hello.php
- <!DOCTYPE html>
- <title>PHP Test</title>
- <head>
- </head>
- <?php echo '<p> Welcome to the world of PHP </p>'; ?>
- <body>
- </body>
- </html>
- 2. Esc : wq
- 3. Open Firefox browser and enter url
- http://localhost/hello.php
- -------------------------------------------------------------------------------------------------------
- GRUB
- # vim /boot/grub/grub.conf
- Change Timeout to 30 sec
- Change Title To NKT Red hat
- Esc : wq
- Esc :w q !
- 5. #init 6 /
Add Comment
Please, Sign In to add comment