ORACLE DBA COMMANDS
[root@sdbt ~]# useradd tesdbuser [root@sdbt ~]# cat /etc/passwd root:x:0:0:root:/root:/bin/bash bin:x:1:1:bin:/bin:/sbin/nologin daemon:x:2:2:daemon:/sbin:/sbin/nologin adm:x:3:4:adm:/var/adm:/sbin/nologin lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin sync:x:5:0:sync:/sbin:/bin/sync shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt mail:x:8:12:mail:/var/spool/mail:/sbin/nologin smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin tesdbuser:x:54322:54335::/home/tesdbuser:/bin/bash [root@sdbt ~]# cd /home [root@sdbt home]# ll total 4 drwx------. 3 tesdbuser 54331 92 Jun 29 16:44 krish drwx------. 22 oracle oinstall 4096 Oct 18 16:50 oracle drwx------. 3 pgbouncer pgbouncer 92 May 26 14:37 pgbouncer drwx------. 3 sdbt sdbt 78 Mar 1 2022 sdbt drwx------. 3 tesdbuser tesdbuser 92 Oct 20 17:46 tesdbuserCreating user with comment: [root@sdbt home]# useradd -c "this is a test user" test_user [root@sdbt home]# cat /etc/passwd|grep test_user test_user:x:54323:54336:this is a test user:/home/test_user:/bin/bashCreating user with expiry date: [root@sdbt home]# useradd -e 2023-11-30 test_user1 [root@sdbt home]# cat /etc/passwd|grep test_user1 test_user1:x:54324:54337::/home/test_user1:/bin/bash [root@sdbt home]# chage -l test_user1 Last password change : Oct 20, 2023 Password expires : never Password inactive : never Account expires : Nov 30, 2023 Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 7Creating user to a particular group: [root@sdbt home]# useradd -g 0 test_user2 [root@sdbt home]# id test_user2 uid=54325(test_user2) gid=0(root) groups=0(root) [root@sdbt home]#2.USERMOD: usermod command or modify user is a command in Linux that is used to change the properties of a user in Linux through the command line. After creating a user we have to sometimes change their attributes like password or login directory etc. so in order to do that we use the Usermod command. usermod command needs to be executed only as a root user. 2.1. To add a comment for a user [root@sdbt home]# usermod -c "this is test user" test_user2 [root@sdbt home]# cat /etc/passwd|grep test_user2 test_user2:x:54325:0:this is test user:/home/test_user2:/bin/bash2.2 To change the expiry date of a user [root@sdbt home]# usermod -e 2023-12-31 test_user2 [root@sdbt home]# chage -l test_user2 Last password change : Oct 20, 2023 Password expires : never Password inactive : never Account expires : Dec 31, 2023 Minimum number of days between password change : 0 Maximum number of days between password change : 99999 Number of days of warning before password expires : 72.3 To change user login name [root@sdbt ~]# cat /etc/passwd|grep test_user2 test_user2:x:54325:0:this is test user:/home/test_user2:/bin/bash You have new mail in /var/spool/mail/root [root@sdbt ~]# usermod -l test_user3 test_user2 usermod: warning: /var/spool/mail/test_user2 not owned by test_user2 [root@sdbt ~]# cat /etc/passwd|grep test_user3 test_user3:x:54325:0:this is test user:/home/test_user2:/bin/bash [root@sdbt ~]#3.USERDEL: userdel command in Linux system is used to delete a user account and related files. userdel -f: This option forces the removal of the specified user account. It doesn’t matter that the user is still logged in. It also forces the userdel to remove the user’s home directory and mail spool, even if another user is using the same home directory or even if the mail spool is not owned by the specified user. userdel -r: Whenever we are deleting a user using this option then the files in the user’s home directory will be removed along with the home directory itself and the user’s mail spool. [root@sdbt ~]# cat /etc/passwd|grep test_user1 test_user1:x:54324:54337::/home/test_user1:/bin/bash [root@sdbt ~]# userdel -r test_user1 [root@sdbt ~]# cat /etc/passwd|grep test_user1 [root@sdbt ~]#4.CHOWN -R: This option is used to apply the changes recursively. [root@sdbt ~]# cd tesdb [root@sdbt tesdb]# ll total 0 [root@sdbt tesdb]# touch test1 [root@sdbt tesdb]# ll total 0 -rw-r--r--. 1 root root 0 Oct 21 11:04 test1 [root@sdbt tesdb]# chown -R oracle:oinstall test1 [root@sdbt tesdb]# ll total 0 -rw-r--r--. 1 oracle oinstall 0 Oct 21 11:04 test1 [root@sdbt tesdb]#5.CHGRP: The `chgrp` command in Linux is used to change the group ownership of a file or directory. Changing Group Ownership of a Single File [root@sdbt ~]# ls -lrt|grep test_file -rw-r--r--. 1 root root 0 Oct 25 12:18 test_file [root@sdbt ~]# chgrp oinstall test_file [root@sdbt ~]# ls -lrt|grep test_file -rw-r--r--. 1 root oinstall 0 Oct 25 12:18 test_file [root@sdbt ~]#Changing Group Ownership of Multiple Files Using the groupname of a reference file [root@sdbt tesdb]# ls -lrt total 06. NETSTAT -PLUNT : will show the Active Internet connections along with port number [root@sdbt tesdb]# netstat -plunt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1722/dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1132/sshd tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1114/cupsd tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 1146/postmaster tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1838/sendmail: acce tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 667/rpcbind tcp6 0 0 :::22 :::* LISTEN 1132/sshd tcp6 0 0 ::1:631 :::* LISTEN 1114/cupsd tcp6 0 0 :::5432 :::* LISTEN 1146/postmaster tcp6 0 0 :::111 :::* LISTEN 667/rpcbind udp 0 0 192.168.122.1:53 0.0.0.0:* 1722/dnsmasq udp 0 0 0.0.0.0:67 0.0.0.0:* 1722/dnsmasq udp 0 0 0.0.0.0:111 0.0.0.0:* 667/rpcbind udp 0 0 0.0.0.0:5353 0.0.0.0:* 732/avahi-daemon: r udp 0 0 0.0.0.0:840 0.0.0.0:* 667/rpcbind udp 0 0 0.0.0.0:26548 0.0.0.0:* 732/avahi-daemon: r udp6 0 0 :::111 :::* 667/rpcbind udp6 0 0 :::840 :::* 667/rpcbind [root@sdbt tesdb]# 7.IPCS : ipcs shows information on the inter-process communication facilities for which the calling process has read access. By default, it shows information about all three resources: shared memory segments, message queues, and semaphore arrays. Without options, the information shall be written in short format for message queues, shared memory segments, and semaphore sets that are currently active in the system 7.1 To list all the IPC facility.All the IPC facility has unique key and identifier, which is used to identify an IPC facility [root@sdbt tesdb]# ipcs -a ------ Message Queues -------- key msqid owner perms used-bytes messages ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x040928db 0 postgres 600 56 6 0x00000000 10 root 777 16384 1 dest 0x00000000 11 root 777 1310720 1 dest 0x00000000 19 root 600 524288 2 dest 0x00000000 23 root 600 524288 2 dest 0x00000000 24 root 777 3932160 2 dest 0x00000000 25 root 777 3932160 2 dest 0x00000000 29 root 600 16777216 2 dest 0x00000000 34 root 600 524288 2 dest 0x00000000 39 root 600 524288 2 dest 0x00000000 40 root 777 3784704 2 dest ------ Semaphore Arrays -------- key semid owner perms nsems7.2:To list all the Message Queue.It lists only message queues for which the current process has read access. [root@sdbt tesdb]# ipcs -q ------ Message Queues -------- key msqid owner perms used-bytes messages7.3 To list all the Semaphores # ipcs -s : To list the accessible semaphores. [root@sdbt tesdb]# ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems7.4 To list all the Shared Memory # ipcs -m : To lists the shared memories. [root@sdbt tesdb]# ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x040928db 0 postgres 600 56 6 0x00000000 10 root 777 16384 1 dest 0x00000000 11 root 777 1310720 1 dest 0x00000000 19 root 600 524288 2 dest 0x00000000 23 root 600 524288 2 dest 0x00000000 24 root 777 3932160 2 dest 0x00000000 25 root 777 3932160 2 dest 0x00000000 29 root 600 16777216 2 dest 0x00000000 34 root 600 524288 2 dest 0x00000000 39 root 600 524288 2 dest 0x00000000 40 root 777 3784704 2 dest8.IPCRM: ipcrm command in Linux is used to remove some IPC(Inter-Process Communication) resources. It eliminates the IPC objects and their associated data structure form the system. One must be a creator or superuser or the owner of the object in order to remove these objects. There are three types of System V IPC objects i.e. semaphores, shared memory, and message queues. Options: -a, –all [shm] [msg] [sem] : Remove all resources. When an option argument is provided, the removal is performed only for the specified resource types. -M, –shmem-key shmkey : Remove the shared memory segment created with shmkey after the last detach is performed. -m, –shmem-id shmid : Remove the shared memory segment identified by shmid after the last detach is performed. -Q, –queue-key msgkey : Remove the message queue created with msgkey. -q, –queue-id msgid : Remove the message queue identified by msgid. -S, –semaphore-key semkey : Remove the semaphore created with semkey. -s, –semaphore-id semid : Remove the semaphore identified by semid. -V, –version : Display version information and exit OUTPUT: [root@sdbt tesdb]# ipcrm -V ipcrm from util-linux 2.23.29. SYSRESV - SYSRESV Utility which does map instances to shared memory segments. This utility can be used to both identify which shared memory segments belong to which instances OUTPUT: [oracle@sdbt ~]$ sysresv -l dev IPC Resources for ORACLE_SID "dev" : Maximum shared memory segment size (shmmax): 4398046511104 bytes Total system shared memory (shmall): 4398046511104 bytes Total system shared memory count (shmmni): 4096 *********************** Dumping ipcs output ******************** ------ Message Queues -------- key msqid owner perms used-bytes messages ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x040928db 0 postgres 600 56 6 0x00000000 10 root 777 16384 1 dest 0x00000000 11 root 777 1310720 1 dest 0x00000000 19 root 600 524288 2 dest 0x00000000 23 root 600 524288 2 dest 0x00000000 24 root 777 3932160 2 dest 0x00000000 25 root 777 3932160 2 dest 0x00000000 29 root 600 16777216 2 dest 0x00000000 34 root 600 524288 2 dest 0x00000000 40 root 777 3784704 2 dest 0x00000000 45 root 600 524288 2 dest 0x00000000 46 root 777 3784704 2 dest 0x00000000 47 oracle 600 8626176 129 0x00000000 48 oracle 600 696254464 65 0x00000000 49 oracle 600 8151040 65 0x5a106d74 50 oracle 600 16384 65 ------ Semaphore Arrays -------- key semid owner perms nsems 0x9501bdcc 4 oracle 600 152 0x9501bdcd 5 oracle 600 152 0x9501bdce 6 oracle 600 152 *********************** End of ipcs command dump ************** ***************** Dumping Resource Limits(s/h) ***************** core file size 0 KB/UNLIMITED data seg size UNLIMITED/UNLIMITED scheduling priority 0 KB/0 KB file size UNLIMITED/UNLIMITED pending signals 6 KB/6 KB max locked memory 128 GB/128 GB max memory size UNLIMITED/UNLIMITED open files 64 KB/64 KB POSIX message queues 800 KB/800 KB real-time priority 0 KB/0 KB stack size 32 MB/32 MB cpu time UNLIMITED/UNLIMITED max user processes 16 KB/16 KB virtual memory UNLIMITED/UNLIMITED file locks UNLIMITED/UNLIMITED ***************** End of Resource Limits Dump ****************** Maximum map count configured per process: 65530 Total /dev/shm size: 887459840 bytes, used: 24576 bytes Shared Memory: ID KEY 48 0x00000000 49 0x00000000 47 0x00000000 50 0x5a106d74 Semaphores: ID KEY 4 0x9501bdcc 5 0x9501bdcd 6 0x9501bdce Oracle Instance alive for sid "dev" [oracle@sdbt ~]$10.HOSTNAME: hostname command in Linux is used to obtain the?DNS (Domain Name System) name 10.1 `-a` Option in `hostname` command in Linux Display all aliases of the host. OUTPUT: [root@sdbt ~]# hostname -a Sdbt [root@sdbt ~]# hostname -f sdbt.localdomain10.2 - HOSTNAME -I: find ipadress [root@sdbt ~]# hostname -i 192.168.1.10111.IFCONFIG : ifconfig(interface configuration) command is used to configure the kernel-resident network interfaces. It is used at the boot time to set up the interfaces as necessary. After that, it is usually used when needed during debugging or when you need system tuning. Also, this command is used to assign the IP address and netmask to an interface or to enable or disable a given interface. OUTPUT: [root@sdbt ~]# ifconfig -a enp0s3: flags=416312. SYSTEMCTL START|STOP|STATUS|RESTART NETWORK: Once you make changes in the server network configuration file, then require to restart the server networking service in order to reflect the changes. OUTPUT: [root@sdbt ~]# systemctl status network ? network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: active (exited) since Wed 2023-10-25 09:32:55 IST; 3h 43min ago Docs: man:systemd-sysv-generator(8) Process: 913 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Tasks: 0 Oct 25 09:32:49 sdbt.localdomain systemd[1]: Starting LSB: Bring up/down networking... Oct 25 09:32:54 sdbt.localdomain network[913]: Bringing up loopback interface: [ OK ] Oct 25 09:32:55 sdbt.localdomain network[913]: Bringing up interface enp0s3: [ OK ] Oct 25 09:32:55 sdbt.localdomain systemd[1]: Started LSB: Bring up/down networking. [root@sdbt ~]# systemctl stop network [root@sdbt ~]# systemctl status network ? network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: inactive (dead) since Wed 2023-10-25 13:16:37 IST; 3s ago Docs: man:systemd-sysv-generator(8) Process: 30714 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 913 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Oct 25 09:32:49 sdbt.localdomain systemd[1]: Starting LSB: Bring up/down networking... Oct 25 09:32:54 sdbt.localdomain network[913]: Bringing up loopback interface: [ OK ] Oct 25 09:32:55 sdbt.localdomain network[913]: Bringing up interface enp0s3: [ OK ] Oct 25 09:32:55 sdbt.localdomain systemd[1]: Started LSB:Bring up/down networking. Oct 25 13:16:34 sdbt.localdomain systemd[1]: Stopping LSB:Bring up/down networking... Oct 25 13:16:36 sdbt.localdomain network[30714]: Shutting down interface enp0s3: Device 'enp0s3' successfully disconnected. Oct 25 13:16:36 sdbt.localdomain network[30714]: [ OK ] Oct 25 13:16:37 sdbt.localdomain network[30714]: Shutting down loopback interface: [ OK ] Oct 25 13:16:37 sdbt.localdomain systemd[1]: Stopped LSB:Bring up/down networking. [root@sdbt ~]# systemctl start network [root@sdbt ~]# systemctl status network ? network.service - LSB: Bring up/down networking Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled) Active: active (exited) since Wed 2023-10-25 13:16:51 IST; 2s ago Docs: man:systemd-sysv-generator(8) Process: 30714 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS) Process: 30921 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS) Tasks: 0 Oct 25 13:16:50 sdbt.localdomain systemd[1]: Starting LSB: Bring up/down networking... Oct 25 13:16:51 sdbt.localdomain network[30921]: Bringing up loopback interface: [ OK ] Oct 25 13:16:51 sdbt.localdomain network[30921]: Bringing up interface enp0s3:Connection successfully activated(D-Bus active pa...tion/4) Oct 25 13:16:51 sdbt.localdomain network[30921]: [ OK ] Oct 25 13:16:51 sdbt.localdomain systemd[1]: Started LSB: Bring up/down networking. Hint: Some lines were ellipsized, use -l to show in full.13. MKDIR : mkdir command in Linux allows the user to create directories (also referred to as folders in some operating systems). This command can create multiple directories at once as well as set the permissions for the directories. mkdir -p :A flag which enables the command to create parent directories as necessary. If the directories exist, no error is specified. OUTPUT: [root@sdbt ~]# mkdir -p tesdb/tesdb1/tesdb2/tesdb3 [root@sdbt ~]# ls -lrt drwxr-xr-x. 3 root root 34 Oct 20 14:44 test -rw-r--r--. 1 root oinstall 0 Oct 25 12:18 test_file drwxr-xr-x. 3 root root 4096 Oct 25 12:18 Pictures drwxr-xr-x. 3 root root 20 Oct 25 13:19 tesdb [root@sdbt ~]# cd tesdb [root@sdbt tesdb]# ls -lrt total 0 drwxr-xr-x. 3 root root 20 Oct 25 13:19 tesdb1 [root@sdbt tesdb]# cd tesdb1 [root@sdbt tesdb1]# ll total 0 drwxr-xr-x. 3 root root 20 Oct 25 13:19 tesdb2 [root@sdbt tesdb1]# cd tesdb2/ [root@sdbt tesdb2]# ll total 0 drwxr-xr-x. 2 root root 6 Oct 25 13:19 tesdb3 [root@sdbt tesdb2]# cd tesdb3/ [root@sdbt tesdb3]# ll total 0 [root@sdbt tesdb3]# pwd /root/tesdb/tesdb1/tesdb2/tesdb3 [root@sdbt tesdb3]#14. TAR: The Linux ‘tar’ stands for tape archive, which is used to create Archive and extract the Archive files. tar command in Linux is one of the important commands which provides archiving functionality in Linux. We can use the Linux tar command to create compressed or uncompressed Archive files and also maintain and modify them. 14.1. Creating an uncompressed tar Archive using option -cvf This command creates a tar file called file.tar which is the Archive of all .c files in the current directory. tar cvf file.tar • ‘-c’: Creates a new archive. • ‘-v’: Displays verbose output, showing the progress of the archiving process. • ‘-f’: Specifies the filename of the archiveOUTPUT : [root@sdbt tesdb]# ls -lrt total 0 -rw-r--r--. 1 root root 0 Oct 25 13:26 test3 -rw-r--r--. 1 root root 0 Oct 25 13:26 test2 -rw-r--r--. 1 root root 0 Oct 25 13:26 test1 [root@sdbt tesdb]# tar -cvf file1.tar test* test1 test2 test3 [root@sdbt tesdb]# ls -lrt total 12 -rw-r--r--. 1 root root 0 Oct 25 13:26 test3 -rw-r--r--. 1 root root 0 Oct 25 13:26 test2 -rw-r--r--. 1 root root 0 Oct 25 13:26 test1 -rw-r--r--. 1 root root 10240 Oct 25 13:27 file1.tar14.2 Extracting files from Archive using option -xvf This command extracts files from Archives. tar xvf file.tar OUTPUT: [root@sdbt tesdb]# ls -lrt total 12 -rw-r--r--. 1 root root 0 Oct 25 13:26 test3 -rw-r--r--. 1 root root 0 Oct 25 13:26 test2 -rw-r--r--. 1 root root 0 Oct 25 13:26 test1 -rw-r--r--. 1 root root 10240 Oct 25 13:27 file1.tar [root@sdbt tesdb]# tar -xvf file1.tar test1 test2 test3 [root@sdbt tesdb]#14.3 Viewing the Archive using option -tvf OUTPUT: [root@sdbt tesdb]# ls -lrt total 12 -rw-r--r--. 1 root root 0 Oct 25 13:26 test3 -rw-r--r--. 1 root root 0 Oct 25 13:26 test2 -rw-r--r--. 1 root root 0 Oct 25 13:26 test1 -rw-r--r--. 1 root root 10240 Oct 25 13:27 file1.tar [root@sdbt tesdb]# tar -tvf file1.tar -rw-r--r-- root/root 0 2023-10-25 13:26 test1 -rw-r--r-- root/root 0 2023-10-25 13:26 test2 -rw-r--r-- root/root 0 2023-10-25 13:26 test3 [root@sdbt tesdb]#15. GZIP: gzip command compresses files. Each single file is compressed into a single file. If given a file as an argument, gzip compresses the file, adds a ".gz" suffix, and deletes the original file. -r option : This option can compress every file in a folder and its subfolders.This option doesn’t create one file called foldername.gz. Instead, it traverses the directory structure and compresses each file in that folder structure. OUTPUT: [root@sdbt tesdb]# gzip -r tesdb1/ [root@sdbt tesdb]# ll total 0 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 [root@sdbt tesdb]# cd tesdb1/ [root@sdbt tesdb1]# ll total 8 -rw-r--r--. 1 root root 26 Oct 25 13:42 test1.gz -rw-r--r--. 1 root root 26 Oct 25 13:42 test2.gz [root@sdbt tesdb1]#-v option: This option displays the name and percentage reduction for each file compressed or decompressed. [root@sdbt tesdb]# ls -lrt total 0 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 0 Oct 25 13:45 tesdbfile [root@sdbt tesdb]# gzip -v tesdbfile tesdbfile: 0.0% -- replaced with tesdbfile.gz [root@sdbt tesdb]# ls -lrt total 4 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 30 Oct 25 13:45 tesdbfile.gz [root@sdbt tesdb]#-d option : This option allows to decompress a file using the "gzip" command [root@sdbt tesdb]# ls -lrt total 4 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 30 Oct 25 13:45 tesdbfile.gz [root@sdbt tesdb]# gzip -d tesdbfile.gz [root@sdbt tesdb]# ls -lrt total 0 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 0 Oct 25 13:45 tesdbfile [root@sdbt tesdb]#Gunzip: This option allows to extract a gzip file [root@sdbt tesdb]# ls -lrt total 4 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 30 Oct 25 13:45 tesdbfile.gz [root@sdbt tesdb]# gunzip tesdbfile.gz [root@sdbt tesdb]# ls -lrt total 0 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 0 Oct 25 13:45 tesdbfile [root@sdbt tesdb]#16.top: The top command is used to show the active Linux processes. top - 13:54:27 up 4:22, 3 users, load average: 0.05, 0.13, 0.16 Tasks: 283 total, 2 running, 224 sleeping, 0 stopped, 0 zombie %Cpu(s): 6.5 us, 1.9 sy, 0.0 ni, 89.8 id, 0.3 wa, 1.5 hi, 0.0 si, 0.0 st KiB Mem : 1733372 total, 24856 free, 858848 used, 849668 buff/cache KiB Swap: 4194300 total, 3990780 free, 203520 used. 382392 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND --------- --- --- ------- ------- ----- - ----- ---- ------------------ 2717 root 20 0 3513196 161880 44012 S 9.0 9.3 1:28.68 gnome-shell 2064 root 20 0 353944 49604 23216 R 4.3 2.9 0:38.83 X 3516 root 20 0 674196 26196 13616 S 2.3 1.5 0:20.10 gnome-terminal- 27544 oracle -2 0 1132620 15428 12776 S 1.3 0.9 0:45.47 ora_vktm_dev 2613 root 20 0 289416 896 844 S 0.7 0.1 0:20.79 VBoxClient 2876 root 20 0 1000400 6596 4532 S 0.3 0.4 0:00.42 gsd-power 1 root 20 0 225292 8188 6100 S 0.0 0.5 0:05.48 systemd 2 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kthreadd 3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp 4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp 6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0:0H-ev 8 root 0 -20 0 0 0 I 0.0 0.0 0:00.63 kworker/0:1H-ev 9 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu_wq 10 root 20 0 0 0 0 S 0.0 0.0 0:00.18 ksoftirqd/0 11 root 20 0 0 0 0 I 0.0 0.0 0:02.67 rcu_sched 12 root rt 0 0 0 0 S 0.0 0.0 0:00.03 migration/0 14 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/0 15 root 20 0 0 0 0 S 0.0 0.0 0:00.00 cpuhp/1 16 root rt 0 0 0 0 S 0.0 0.0 0:00.32 migration/1 17 root 20 0 0 0 0 S 0.0 0.0 0:00.15 ksoftirqd/1 19 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/1:0H-ev 22 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs 23 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 netns 24 root 20 0 0 0 0 S 0.0 0.0 0:00.01 kauditd 25 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khungtask17.ps -ef: The ps command in Linux is a powerful tool that allows you to view information about the processes running on your Linux system. Options:
OUTPUT: [root@sdbt ~]# ps -ef UID PID PPID C STIME TTY TIME CMD root 1 0 0 09:31 ? 00:00:05 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 root 2 0 0 09:31 ? 00:00:00 [kthreadd] root 3 2 0 09:31 ? 00:00:00 [rcu_gp] root 4 2 0 09:31 ? 00:00:00 [rcu_par_gp] root 6 2 0 09:31 ? 00:00:00 [kworker/0:0H-ev] root 8 2 0 09:31 ? 00:00:00 [kworker/0:1H-kb] root 9 2 0 09:31 ? 00:00:00 [mm_percpu_wq] root 10 2 0 09:31 ? 00:00:00 [ksoftirqd/0] root 11 2 0 09:31 ? 00:00:02 [rcu_sched] root 12 2 0 09:31 ? 00:00:00 [migration/0] root 14 2 0 09:31 ? 00:00:00 [cpuhp/0] root 15 2 0 09:31 ? 00:00:00 [cpuhp/1] root 16 2 0 09:31 ? 00:00:00 [migration/1] root 17 2 0 09:31 ? 00:00:00 [ksoftirqd/1] root 19 2 0 09:31 ? 00:00:00 [kworker/1:0H-ev] root 22 2 0 09:31 ? 00:00:00 [kdevtmpfs] root 23 2 0 09:31 ? 00:00:00 [netns] root 24 2 0 09:31 ? 00:00:00 [kauditd] root 25 2 0 09:31 ? 00:00:00 [khungtaskd] root 26 2 0 09:31 ? 00:00:00 [oom_reaper] root 27 2 0 09:31 ? 00:00:00 [writeback] root 28 2 0 09:31 ? 00:00:00 [kcompactd0] root 29 2 0 09:31 ? 00:00:00 [ksmd] root 84 2 0 09:31 ? 00:00:00 [kintegrityd] root 85 2 0 09:31 ? 00:00:00 [kblockd] root 86 2 0 09:31 ? 00:00:00 [blkcg_punt_bio] root 87 2 0 09:31 ? 00:00:00 [tpm_dev_wq] root 88 2 0 09:31 ? 00:00:00 [md] root 89 2 0 09:31 ? 00:00:00 [edac-poller] root 90 2 0 09:31 ? 00:00:00 [devfreq_wq] root 91 2 0 09:31 ? 00:00:00 [watchdogd] root 93 2 0 09:31 ? 00:00:05 [kswapd0:0] root 95 2 0 09:31 ? 00:00:00 [kthrotld] root 96 2 0 09:31 ? 00:00:00 [acpi_thermal_pm]18. Iostat: The iostat command is used for monitoring system input/output device loading by observing the time the devices are active in relation to their average transfer rates. Options:
[root@sdbt test]# iostat Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/20/2023 _x86_64_ (2 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 0.50 0.08 1.58 3.69 0.00 94.16 Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn -------- ----- ---------- ---------- ---------- -------- sda 9.57 301.44 135.42 5630832 2529592 scd0 0.00 0.00 0.00 62 0 [root@sdbt test]#19.Vmstat: The vmstat command reports statistics about kernel threads in the run and wait queue, memory, paging, disks, interrupts, system calls, context switches, and CPU activity. [root@sdbt test]# vmstat procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu----- r b swpd free buff cache si so bi bo in cs us sy id wa st 2 0 267520 47452 20 902952 1 8 151 68 629 588 1 2 94 4 0 [root@sdbt test]#20.Cpuinfo: cpu in Linux is used to get CPU information of the system. How to ch eck how many CPUs are there in the Linux system
[root@sdbt test]# cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 126 model name : Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz stepping : 5 cpu MHz : 1190.391 cache size : 4096 KB physical id : 0 siblings : 2 core id : 0 cpu cores : 2 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single fsgsbase avx2 invpcid rdseed clflushopt md_clear flush_l1d arch_capabilities bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit srbds mmio_stale_data retbleed bogomips : 2380.78 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: processor : 1 vendor_id : GenuineIntel cpu family : 6 model : 126 model name : Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz stepping : 5 cpu MHz : 1190.391 cache size : 4096 KB physical id : 0 siblings : 2 core id : 1 cpu cores : 2 apicid : 1 initial apicid : 1 fpu : yes fpu_exception : yes cpuid level : 22 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single fsgsbase avx2 invpcid rdseed clflushopt md_clear flush_l1d arch_capabilities. bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit srbds mmio_stale_data retbleed bogomips : 2380.78 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management: [root@sdbt test]#21.Meminfo: The /proc/meminfo file inside the /proc pseudo-filesystem provides a usage report about memory on the system. [root@sdbt test]# cat /proc/meminfo MemTotal: 1733372 kB MemFree: 138520 kB MemAvailable: 344832 kB Buffers: 20 kB Cached: 755712 kB SwapCached: 9368 kB Active: 991084 kB Inactive: 346272 kB Active(anon): 848332 kB Inactive(anon): 288344 kB Active(file): 142752 kB Inactive(file): 57928 kB Unevictable: 12388 kB Mlocked: 12388 kB SwapTotal: 4194300 kB SwapFree: 3926780 kB Dirty: 40 kB Writeback: 0 kB AnonPages: 588860 kB Mapped: 411972 kB Shmem: 544528 kB KReclaimable: 34576 kB Slab: 108608 kB SReclaimable: 34576 kB SUnreclaim: 74032 kB KernelStack: 9280 kB PageTables: 83472 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 5060984 kB Committed_AS: 5818820 kB VmallocTotal: 34359738367 kB VmallocUsed: 34944 kB VmallocChunk: 0 kB Percpu: 600 kB HardwareCorrupted: 0 kB AnonHugePages: 0 kB ShmemHugePages: 0 kB ShmemPmdMapped: 0 kB FileHugePages: 0 kB FilePmdMapped: 0 kB CmaTotal: 0 kB CmaFree: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 0 kB DirectMap4k: 145344 kB DirectMap2M: 1951744 kB [root@sdbt test]#22.Su: The su command changes user credentials to those of the root user or to the user specified by the Name parameter, and initiates a new session. [root@sdbt test]# su - oracle Last login: Fri Oct 20 11:13:17 IST 2023 on pts/123.free -G: The free command in Linux is a commonly used utility that provides information about the system's memory usage, including both physical and virtual memory. [root@sdbt ~]# free --g total used free shared buff/cache available Mem: 1 0 0 0 0 0 Swap: 3 0 3 [root@sdbt ~]#24.Uname: The command ‘uname‘ displays the information about the system. Options: [root@sdbt ~]# uname Linux24.Umask: Umask (short for user file-creation mode mask) is used by UNIX-based systems to set default permissions for newly created files and directories. [root@sdbt ~]# umask 002225.Passwd : The passwd command changes the login password or password phrase for the user ID specified. [oracle@sdbt ~]$ su - root Password: Last login: Fri Oct 20 15:49:14 IST 2023 on pts/0 [root@sdbt ~]# passwd oracle Changing password for user oracle. New password: BAD PASSWORD: The password is shorter than 8 characters Retype new password: passwd: all authentication tokens updated successfully. [root@sdbt ~]#26.Find : Helps you find things, and not just by filename. 26.1:Delete Files Older Than X Minutes [root@sdbt tesdb]# ls -lrt total 0 drwxr-xr-x. 2 root root 38 Oct 25 13:43 tesdb1 -rw-r--r--. 1 root root 0 Oct 25 13:45 tesdbfile [root@sdbt tesdb]# [root@sdbt tesdb]# find . -name "tes*" -type f -mmin +30 -delete [root@sdbt tesdb]# ll total 0 drwxr-xr-x. 2 root root 6 Oct 25 15:28 tesdb1 [root@sdbt tesdb]# First, we’ve specified the starting point for files lookup, it’s the current working directory ".". Then, we have the file name criteria prefixed with the -name switch. The switch -type f means we want to look for files only. The -mmin stands for the modification time, and +15 means we want files that were last modified 15 minutes ago or earlier.26.2 Delete Files Older Than X Days : It only takes a small change to the find command to switch from minutes to days: find . -name "access*.log" -type f -mtime +5 -delete Here, the -mtime switch says we want to delete files that were modified at least 5 days ago.26.3 Delete Files Older Than X Days With a Prompt : We might be concerned that an incorrectly constructed delete command might end updeleting the wrong files. 27.Who: who command is a tool print information about users who are currently logged in. [root@sdbt ~]# who root :0 2023-10-20 09:50 (:0) root pts/0 2023-10-20 09:50 (:0) root pts/1 2023-10-20 11:13 (:0) [root@sdbt ~]#28.Ping: The ping command in Linux is a utility that helps to test connectivity between two devices on a network. [root@sdbt ~]# ping Usage: ping [-aAbBdDfhLnOqrRUvV64] [-c count] [-i interval] [-I interface] [-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline] [-W timeout] [hop1 ...] destination Usage: ping -6 [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface] [-l preload] [-m mark] [-M pmtudisc_option] [-N nodeinfo_option] [-p pattern] [-Q tclass] [-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option] [-w deadline] [-W timeout] destination [root@sdbt tesdb]# ping google.com PING google.com (142.250.195.110) 56(84) bytes of data. 64 bytes from maa03s39-in-f14.1e100.net (142.250.195.110): icmp_seq=1 ttl=119 time=6.68 ms 64 bytes from maa03s39-in-f14.1e100.net (142.250.195.110): icmp_seq=2 ttl=119 time=7.07 ms 64 bytes from maa03s39-in-f14.1e100.net (142.250.195.110): icmp_seq=3 ttl=119 time=7.46 ms ^C --- google.com ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 6.682/7.072/7.460/0.324 ms29.Awk: Awk is a scripting language used for manipulating data and generating reports. The awk command programming language requires no compiling and allows the user to use variables, numeric functions, string functions, and logical operators. [root@sdbt tesdb]# cat > employee.txt ajay manager account 45000 sunil clerk account 25000 varun manager sales 50000 amit manager account 47000 tarun peon sales 15000 deepak clerk sales 23000 sunil peon sales 13000 satvik director purchase 80000 [root@sdbt tesdb]# cat employee.txt ajay manager account 45000 sunil clerk account 25000 varun manager sales 50000 amit manager account 47000 tarun peon sales 15000 deepak clerk sales 23000 sunil peon sales 13000 satvik director purchase 8000029.1.Default behavior of Awk: By default Awk prints every line of data from the specified file. [root@sdbt tesdb]# awk '{print}' employee.txt ajay manager account 45000 sunil clerk account 25000 varun manager sales 50000 amit manager account 47000 tarun peon sales 15000 deepak clerk sales 23000 sunil peon sales 13000 satvik director purchase 80000 [root@sdbt tesdb]#29.2.Print the lines which match the given pattern [root@sdbt tesdb]# awk '/manager/ {print}' employee.txt ajay manager account 45000 varun manager sales 50000 amit manager account 4700029.3. Splitting a Line Into Fields : For each record i.e line, the awk command splits the record delimited by whitespace character by default and stores it in the $n variables. If the line has 4 words, it will be stored in $1, $2, $3 and $4 respectively. Also, $0 represents the whole line. [root@sdbt tesdb]# awk '{print $1,$4}' employee.txt ajay 45000 sunil 25000 varun 50000 amit 47000 tarun 15000 deepak 23000 sunil 13000 satvik 8000029.4 Use of NR built-in variables (Display Line Number) [root@sdbt tesdb]# awk '{print NR,$0}' employee.txt 1 ajay manager account 45000 2 sunil clerk account 25000 3 varun manager sales 50000 4 amit manager account 47000 5 tarun peon sales 15000 6 deepak clerk sales 23000 7 sunil peon sales 13000 8 satvik director purchase 8000029.5 Another use of NR built-in variables (Display Line From 3 to 6) [root@sdbt tesdb]# awk 'NR==3, NR==6 {print NR,$0}' employee.txt 3 varun manager sales 50000 4 amit manager account 47000 5 tarun peon sales 15000 6 deepak clerk sales 2300030.Yum: Yum is a command-line package manager for RPM-based Linux systems, such as Red Hat Enterprise Linux, CentOS, Fedora, and Oracle Linux. Options: -h, --help show this help message and exit -t, --tolerant be tolerant of errors -C, --cacheonly run entirely from system cache, don't update cache -c [config file], --config=[config file] config file location -R [minutes], --randomwait=[minutes] maximum command wait time -d [debug level], --debuglevel=[debug level] debugging output level --showduplicates show duplicates, in repos, in list/search commands -e [error level], --errorlevel=[error level] error output level --rpmverbosity=[debug level name] debugging output level for rpm -q, --quiet quiet operation -v, --verbose verbose operation -y, --assumeyes answer yes for all questions --assumeno answer no for all questions --version show Yum version and exit --installroot=[path] set install root --enablerepo=[repo] enable one or more repositories (wildcards allowed) --disablerepo=[repo] disable one or more repositories (wildcards allowed) -x [package], --exclude=[package] exclude package(s) by name or glob --disableexcludes=[repo] disable exclude from main, for a repo or for everything --disableincludes=[repo] disable includepkgs for a repo or for everything --obsoletes enable obsoletes processing during updates --noplugins disable Yum plugins --nogpgcheck disable gpg signature checking --disableplugin=[plugin] disable plugins by name --enableplugin=[plugin] enable plugins by name --skip-broken skip packages with depsolving problems --color=COLOR control whether color is used --releasever=RELEASEVER set value of $releasever in yum config and repo files --downloadonly don't update, just download --downloaddir=DLDIR specifies an alternate directory to store packages --setopt=SETOPTS set arbitrary config and repo options --bugfix Include bugfix relevant packages, in updates --security Include security relevant packages, in updates --advisory=ADVS, --advisories=ADVS Include packages needed to fix the given advisory, in updates --bzs=BZS Include packages needed to fix the given BZ, in updates --cves=CVES Include packages needed to fix the given CVE, in updates --sec-severity=SEVS, --secseverity=SEVS Include security relevant packages matching the severity, in updatesPlugin Options: 30.1. To Install a. To install any package on the Linux system, we can fire the yum installand the package name: # yum install package1.rpm # yum install package1.rpm package2.rpm package3.rpm package4.rpm b. Yum utility generally ask for the confirmation for package installation, if you want to specify it in the command itself then fire below command # yum install package1.rpm -y30.2. To Search To search for any package on the RPM repository (it can be RHN, Cent OS repository etc.): # yum search package1.rpm # yum search package1 package2 # yum search all30.3. To Update To update any existing package on the system fire below update command: # yum update package1.rpm # yum update package1.rpm package2.rpm # yum update package1.rpm -y30.4. To remove/uninstall To remove any existing package from the system: # yum remove package1.rpm # yum remove package1.rpm package2.rpm # yum remove package1.rpm -y30.5. To update the entire system for the available updates from Vendor repository: # yum check-update # yum update # yum update –y # yum update yum30.6. Get info : To get the information about any package: # yum info yum # yum info vsftpd31. /etc/redhat-release : To display the Red Hat Enterprise Linux version [root@sdbt tesdb]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.9 (Maipo)32.KILL: kill command in Linux (located in /bin/kill), is a built-in command which is used to terminate processes manually. kill command sends a signal to a process that terminates the process. If the user doesn’t specify any signal which is to be sent along with the kill command, then a default TERM signal is sent that terminates the process. 32.1. kill -l To display all the available signals, you can use the below command option: [root@sdbt tesdb]# kill -l 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL 5) SIGTRAP 6) SIGABRT 7) SIGBUS 8) SIGFPE 9) SIGKILL 10) SIGUSR1 11) SIGSEGV 12) SIGUSR2 13) SIGPIPE 14) SIGALRM 15) SIGTERM 16) SIGSTKFLT 17) SIGCHLD 18) SIGCONT 19) SIGSTOP 20) SIGTSTP 21) SIGTTIN 22) SIGTTOU 23) SIGURG 24) SIGXCPU 25) SIGXFSZ 26) SIGVTALRM 27) SIGPROF 28) SIGWINCH 29) SIGIO 30) SIGPWR 31) SIGSYS 34) SIGRTMIN 35) SIGRTMIN+1 36) SIGRTMIN+2 37) SIGRTMIN+3 38) SIGRTMIN+4 39) SIGRTMIN+5 40) SIGRTMIN+6 41) SIGRTMIN+7 42) SIGRTMIN+8 43) SIGRTMIN+9 44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9 56) SIGRTMAX-8 57) SIGRTMAX-7 58) SIGRTMAX-6 59) SIGRTMAX-5 60) SIGRTMAX-4 61) SIGRTMAX-3 62) SIGRTMAX-2 63) SIGRTMAX-1 64) SIGRTMAX32.2 kill PID This option specifies the process ID of the process to be killed. root@sdbt ~]# ps PID TTY TIME CMD 24370 pts/0 00:00:00 bash 24473 pts/0 00:00:00 ps [root@sdbt ~]# kill 24473 bash: kill: (24473) - No such process32.3. Signals can be specified in three ways: Signals can be specified in three ways; they are as follows: 1) By number: We can specify a signal using a number. For example, we have a PID `1212` and want to send a `SIGKILL` signal to kill this PID. SIGKILL has a signal number of `9` (To find signal numbers run `kill -l` command). Syntax: [root@sdbt ~]# ps PID TTY TIME CMD 24370 pts/0 00:00:00 bash 25568 pts/0 00:00:00 ps [root@sdbt ~]# kill -9 255682) With SIG prefix (e.g/ -SIGkill) We can also specify signal using SIG prefix. For example, we need to send a signal `SIGTERM` and PID is `1432`. To just check signal number of `SIGTERM`signal we can use `kill -l` command. Syntax: kill -SIGTERM 2556833. nohup and & DISPLAY: A command in Linux systems that keep processes running even after exiting the shell or terminal [root@sdbt ~]# nohup df -h nohup: ignoring input and appending output to ‘nohup.out’ You have new mail in /var/spool/mail/root [root@sdbt ~]# cat nohup.out Filesystem Size Used Avail Use% Mounted on devtmpfs 829M 0 829M 0% /dev tmpfs 847M 24K 847M 1% /dev/shm tmpfs 847M 9.4M 837M 2% /run tmpfs 847M 0 847M 0% /sys/fs/cgroup /dev/sda2 56G 33G 24G 59% / newshared 441G 154G 287G 35% /media/sf_newshared tmpfs 170M 32K 170M 1% /run/user/0 /dev/sr0 59M 59M 0 100% /run/media/root/VBox_GAs_6.1.34 [root@sdbt ~]# nohup date nohup: ignoring input and appending output to ‘nohup.out’ [root@sdbt ~]# cat nohup.out Filesystem Size Used Avail Use% Mounted on devtmpfs 829M 0 829M 0% /dev tmpfs 847M 24K 847M 1% /dev/shm tmpfs 847M 9.4M 837M 2% /run tmpfs 847M 0 847M 0% /sys/fs/cgroup /dev/sda2 56G 33G 24G 59% / newshared 441G 154G 287G 35% /media/sf_newshared tmpfs 170M 32K 170M 1% /run/user/0 /dev/sr0 59M 59M 0 100% /run/media/root/VBox_GAs_6.1.34 Wed Oct 25 16:47:07 IST 202334.sysctl.conf: In Linux, sysctl.conf is a configuration file used to control various kernel parameters and settings. It allows you to configure and tune the behavior of the Linux kernel to suit your specific needs. This file is typically located in the /etc/sysctl.conf or /etc/sysctl.d/ directory. View Current Kernel Parameters: You can view the current kernel parameters and their values using the sysctl command. For example, to view the net.ipv4.ip_forward parameter, you can use the following command: [root@sdbt ~]# sysctl net.ipv4.ip_forward net.ipv4.ip_forward = 0 [root@sdbt ~]#Edit sysctl.conf: To configure kernel parameters persistently, you can edit the sysctl.conf file. You will typically need root privileges to edit this file. You can use a text editor like nano or vi to open the file: Vi /etc/sysctl.confSet Kernel Parameters: Inside the sysctl.conf file, you can set various parameters using the following format: parameter_name = value For example, to enable IP forwarding, you can add the following line to the file: net.ipv4.ip_forward = 1Reload Configuration: After editing the sysctl.conf file, you need to reload the configuration to apply the changes without rebooting the system. You can do this using the following command: sysctl -p35.ORATAB: The oratab file in Linux is a configuration file specific to Oracle Database installations. It is used to manage the automatic startup and shutdown of Oracle database instances on a given system. The oratab file is typically located in the /etc directory, and its full path is usually /etc/oratab. Here's how the oratab file works: Listing Oracle Instances: The oratab file contains a list of Oracle database instances installed on the system. Each line in the file represents one instance and has the following format: [oracle@sdbt ~]$ cat /etc/oratab # # This file is used by ORACLE utilities. It is created by root.sh # and updated by either Database Configuration Assistant while creating # a database or ASM Configuration Assistant while creating ASM instance. # A colon, ':', is used as the field terminator. A new line terminates # the entry. Lines beginning with a pound sign, '#', are comments. # # Entries are of the form: # $ORACLE_SID:$ORACLE_HOME: # # The first and second fields are the system identifier and home # directory of the database respectively. The third field indicates # to the dbstart utility that the database should , "Y", or should not, # "N", be brought up at system boot time. # # Multiple entries with the same $ORACLE_SID are not allowed. # # dev:/u01/app/oracle/product/12.2.0/dbhome_1:N orcl:/u01/app/oracle/product/12.2.0/dbhome_1:N Editing the oratab File: If you install or remove Oracle instances, you may need to manually edit the oratab file to add or remove entries for those instances. Be sure to follow the specified format when making changes. It's essential to use caution when editing the oratab file, as incorrect entries can lead to issues with Oracle instance management. Changes to the file should be made by individuals with appropriate privileges and knowledge of Oracle Database administration. 36: chkconfig: chkconfig is a command in Linux used to manage and view the services and daemons that are configured to start automatically at boot time. It is typically used on systems that use the SysV init system or Systemd. Here are some common chkconfig commands and their usage: 36.1. List All Services : To list all services and their current runlevel settings [root@sdbt ~]# chkconfig --listNote: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:on 3:on 4:on 5:on 6:off rhnsd 0:off 1:off 2:on 3:on 4:on 5:on 6:off36.2. Check the Status of a Specific Service: Check the Status of a Specific Service: You can check the status of a specific service for a particular runlevel using the following syntax: chkconfig --list36.3.Enable a Service: To enable a service to start automatically at boot time, you can use the --level option. For example, to enable the Apache web server (httpd) to start at runlevels 3 and 5, use: chkconfig --level 35 httpd on37.mount : In Linux, the mount command is used to attach (mount) a file system to a specific directory in the file system hierarchy. This process allows you to access the files and data on the mounted file system as if they were part of your local file system. Mounting is a fundamental operation in Linux and is used to work with various types of storage devices, network file systems, and more.the basic syntax of the mount command: mount [options] source destination source: This is the device or file containing the file system you want to mount. It can be a device name (e.g., a hard drive partition such as /dev/sdb1), a network location (e.g., an NFS or SMB share), or a disk image file. destination: This is the directory where you want to mount the file system. It must be an empty directory, and its contents will be hidden while the file system is mounted. Common options used with the mount command include -t to specify the file system type (e.g., ext4, NFS, or SMB), and various options for specific file systems. Mount a USB Drive: To mount a USB drive located at /dev/sdb1 to a directory such as /mnt/usb, you can use the following command: mount /dev/sdb1 /mnt/usb Mount a Network Share (NFS): To mount a network share from an NFS server, you would use a command like this: mount -t nfs server:/share /mnt/nfs Mount an ISO Image: We can also mount an ISO image file directly to a directory. For example: mount -o loop /path/to/your.iso /mnt/iso The mount command has many options and is highly versatile. It is an essential tool for managing file systems and storage devices in Linux. Be cautious when using the mount command, as incorrect usage can lead to data loss or other issues. Always ensure that the destination directory is empty and take care when specifying options for different file system types. 38.Unmount a File System: In Linux, the umount command is used to unmount (or detach) a currently mounted file system, making it no longer accessible through the specified mount point. Properly unmounting file systems is important to ensure data integrity and prevent potential data corruption. Here is the basic syntax of the umount command: umount [options] targettarget: This is the directory where the file system is mounted. When you use umount, you specify the path to the mount point, not the device or file. Common options used with the umount command include -l (lazy unmount, allowing the file system to be unmounted when it is no longer in use) and -f (force unmount, even if the file system is busy). Unmount a Mounted Directory: To unmount a directory, such as /mnt/usb, you would use the following command: umount /mnt/usbLazy Unmount: If the file system is in use (e.g., files are open), you can use the -l option for a lazy unmount. This allows the file system to be unmounted when it's no longer in use: umount -l /mnt/usbForce Unmount: In some cases, you may need to forcibly unmount a busy file system. Use the -f option, but be cautious as this can lead to data corruption: umount -f /mnt/usb Remember that it's essential to unmount file systems properly to avoid data corruption. For network file systems, unmounting might involve additional steps, such as disconnecting from the network share or using specific commands for that file system type. Always ensure that you're not actively using the files within the file system before unmounting. 39.mkfs.ext3: The mkfs.ext3 command in Linux is used to create an Ext3 file system on a block device or a partition. Ext3 is a widely used file system in Linux, known for its journaling capabilities, which help improve data integrity and recovery in the event of unexpected system crashes. Here is the basic syntax for creating an Ext3 file system using mkfs.ext3: mkfs.ext3 [options] device device: This is the block device or partition where you want to create the Ext3 file system. You should specify the path to the device, such as /dev/sdX1, where "X" represents the drive letter and "1" is the partition number. Common options for mkfs.ext3 include specifying the block size (-b), the inode size (-I), and others. However, many of these options can be left to their default values, and the file system will be created with reasonable defaults. Here's an example of creating an Ext3 file system on a partition: mkfs.ext3 /dev/sdX1(Replace /dev/sdX1 with the actual device or partition you want to format as Ext3.) After running the mkfs.ext3 command, the file system on the specified device or partition will be created, and you can then mount it to a directory to start using it. Please note that mkfs.ext3 is part of the e2fsprogs package, which is usually pre-installed on most Linux distributions. Always use caution when formatting a device or partition, as it will erase all data on that storage medium. Double-check that you are formatting the correct device to avoid data loss. 40.how to add new disk for OEL (linux) ADD NEW DISK(fdisk -l,mount, mkfs.ext3 fdisk also known as format disk is a dialog-driven command in Linux used for creating and manipulating disk partition table. It is used for the view, create, delete, change, resize, copy and move partitions on a hard drive using the dialog-driven interface. fdisk allows you to create a maximum of four primary partitions and the number of logical partition depends on the size of the hard disk you are using. It allows the user:
Command Purpose fdisk -m Print the available (FDISK) commands fdisk -p Print the partition table 0 ====================================================== fdisk -d Delete a partition ======================================================= fdisk -l to view details of available disk partitions. ======================================================= Create a Hard Disk Partition: For this go inside the hard drive partition that is the /dev/sdb partition, and use the following command: fdisk /dev/sdb fdisk -w Write the table to the hard drive Now you have to type n to create new partition and then type p for making a primary
partition and e for making an View Partition on a Specific Disk: Below command is used to view all disk partitions on device /dev/sda. fdisk -s /dev/sda to view the partition size. 41.RPM: In Linux, the rpm command is used to manage Red Hat Package Manager (RPM) packages. The rpm command has various options and subcommands for performing different package-related operations. The rpm -uvh command is used to upgrade or install an RPM package with some specific options: Query all installed packages: rpm -qa [root@sdbt ~]# rpm -qa|grep oracle oraclelinux-release-7.9-1.0.9.el7.x86_64 oraclelinux-release-el7-1.0-17.el7.x86_64 oracle-logos-70.7.0-1.0.7.el7.noarch oracle-database-server-12cR2-preinstall-1.0-5.el7.x86_64 [root@sdbt ~]#OPTIONS IN rpm: -i | --install: This option is used to install a new package rpm -i sample_package.rpm -q | --query: This option is used to query an installed package or a .rpm package file. rpm -q sample_package -e | --erase: This option is used to remove an installed package. rpm -e sample_packageAdvanced Use Cases of rpm Command in Linux Upgrade a package: rpm -U sample_package.rpm Verify an installed package: rpm -V sample_package-u : This option stands for "upgrade." It allows you to upgrade an existing package if it's already installed or install it if it's not already installed. -v : This option stands for "verbose." It provides more detailed information about the installation or upgrade process, showing the progress. -h : This option stands for "hash." It displays a progress bar during the installation or upgrade to give you an indication of how far along the process is. Here's how you can use the rpm -uvh command: rpm -uvh package.rpmReplace package.rpm with the actual name of the RPM package you want to upgrade or install. For example, if you have a package named "example.rpm," you can use the following command to upgrade or install it: rpm -uvh example.rpmThis command will upgrade the package if it's already installed, or it will install it if it's not already on your system, all while providing a verbose output and a progress bar. 42.DF - disk free space: df43.DU - DISK USAGE: The du (disk usage) command measures the disk space occupied by files or directories. What is the du *| sort command? du -skhThe du command in Linux is used to estimate the space used by files and directories. The options you provided, du -skh, have the following meanings: du : The disk usage command. -s : This option stands for "summarize." It causes du to display only the total usage for each argument (i.e., the total usage of the specified file or directory and its subdirectories) , rather than a detailed breakdown of every subdirectory. -k : This option stands for "kilobytes." It displays the sizes in kilobytes, which is a common unit for disk space measurement. -h : This option stands for "human-readable." It makes the output more human-friendly by using larger units (e.g., K for kilobytes, M for megabytes) when the sizes are too large. This option is useful for making the output easier to read. [root@sdbt ~]# du -skh tesdb 0K tesdb 44. SAR: What is sar command linux monitor system performance? The "sar" command in Linux is a powerful system performance monitoring tool that stands for "System Activity Reporter." It collects, reports, and analyzes various system activity and performance metrics, providing administrators with valuable insights into the health and efficiency of a Linux system. The "sar" command is part of the "sysstat" package, which is a set of utilities for collecting and reporting system performance data CPU Usage Details : To report CPU details a total of 5 times with the interval of 2 seconds. If the interval command is set to zero, average statistics from the time system started are presented. If the count is not provided and the interval is given, statistics are provided continuously after every interval. sar -u (cpu): [root@sdbt ~]# sar -usar -q (load average) Run Queue Length and Load Average To report run queue length, number of processes and load average [root@sdbt ~]# sar -q Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/26/2023 _x86_64_ (2 CPU) 09:22:32 AM LINUX RESTART 09:30:01 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 09:40:03 AM 1 508 0.50 0.50 0.45 0 09:50:02 AM 1 506 0.03 0.14 0.27 0 10:00:01 AM 0 504 0.00 0.02 0.14 0 10:10:01 AM 0 504 0.00 0.00 0.06 1 10:20:01 AM 0 505 0.00 0.00 0.02 0 10:30:01 AM 0 505 0.00 0.02 0.00 0 10:40:01 AM 3 512 0.03 0.06 0.01 0 10:50:01 AM 0 510 0.01 0.04 0.02 0 11:00:01 AM 1 512 0.08 0.06 0.01 0 11:10:01 AM 0 512 0.09 0.08 0.02 0 11:20:01 AM 0 511 0.01 0.04 0.01 0 11:30:01 AM 0 511 0.00 0.02 0.00 0 11:40:04 AM 0 573 0.21 0.84 0.54 0 Average: 0 513 0.07 0.14 0.12 0 11:55:49 AM LINUX RESTART 12:01:41 PM LINUX RESTART 12:10:05 PM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 12:20:03 PM 0 573 0.29 0.41 0.52 0 12:30:01 PM 0 575 0.09 0.13 0.31 3 12:40:01 PM 0 570 0.16 0.08 0.18 1 12:50:01 PM 0 568 0.14 0.11 0.15 1 01:00:01 PM 0 568 0.22 0.14 0.13 0 01:10:02 PM 1 568 0.04 0.17 0.15 0 01:20:01 PM 1 571 0.02 0.04 0.08 1 01:30:01 PM 3 575 0.08 0.06 0.08 0 01:40:02 PM 0 571 0.33 0.62 0.36 0 01:50:01 PM 1 570 0.32 0.24 0.26 0 02:00:03 PM 0 568 0.03 0.13 0.20 0 02:10:01 PM 0 568 0.37 0.25 0.20 0 02:20:01 PM 1 570 0.04 0.11 0.14 0 02:30:02 PM 0 574 0.04 0.07 0.09 0 02:40:01 PM 0 570 0.03 0.05 0.07 1 02:50:01 PM 0 568 0.15 0.13 0.09 0 03:00:01 PM 0 569 0.16 0.16 0.12 0 03:10:01 PM 0 570 0.04 0.04 0.06 0 03:20:01 PM 0 571 0.07 0.06 0.06 0 03:30:01 PM 1 574 0.11 0.04 0.03 0 03:40:01 PM 0 573 0.09 0.05 0.01 1 04:30:01 PM 0 575 0.15 0.10 0.03 0 Average: 0 571 0.14 0.14 0.15 0sar -S (Swap) Swapping Statistics To report statistics about swappingsar -q Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/26/2023 _x86_64_ (2 CPU) 09:22:32 AM LINUX RESTART 09:30:01 AM runq-sz plist-sz ldavg-1 ldavg-5 ldavg-15 blocked 09:40:03 AM 1 508 0.50 0.50 0.45 0 09:50:02 AM 1 506 0.03 0.14 0.27 0 10:00:01 AM 0 504 0.00 0.02 0.14 0 10:10:01 AM 0 504 0.00 0.00 0.06 1 10:20:01 AM 0 505 0.00 0.00 0.02 0 10:30:01 AM 0 505 0.00 0.02 0.00 0 10:40:01 AM 3 512 0.03 0.06 0.01 0 10:50:01 AM 0 510 0.01 0.04 0.02 0 11:00:01 AM 1 512 0.08 0.06 0.01 0 11:10:01 AM 0 512 0.09 0.08 0.02 0 11:20:01 AM 0 511 0.01 0.04 0.01 0 11:30:01 AM 0 511 0.00 0.02 0.00 0 11:40:04 AM 0 573 0.21 0.84 0.54 0 Average: 0 513 0.07 0.14 0.12 0sar -r Unused Memory sar -r (Memory Usage Details)To report about the amount of memory used, amount of memory free, available cache, available buffers total 3 times with the interval of 1 second. [root@sdbt ~]# sar -r Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/26/2023 _x86_64_ (2 CPU) 09:22:32 AM LINUX RESTART 09:30:01 AM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 09:40:03 AM 27508 1705864 98.41 32 814188 4475828 75.51 900284 587192 4528 09:50:02 AM 257372 1476000 85.15 20 788104 4265952 71.97 445112 827508 4 10:00:01 AM 257064 1476308 85.17 20 788720 4269780 72.03 444916 827968 4 10:10:01 AM 256472 1476900 85.20 20 788936 4265352 71.96 445260 827956 4 10:20:01 AM 250076 1483296 85.57 20 794496 4265980 71.97 445840 833480 8 10:30:01 AM 249272 1484100 85.62 20 795244 4266584 71.98 446524 833384 28 10:40:01 AM 208000 1525372 88.00 20 820784 4306848 72.66 471348 845616 28 10:50:01 AM 207204 1526168 88.05 20 821212 4305216 72.63 471588 845952 24 11:00:01 AM 60760 1672612 96.49 20 966908 4311808 72.74 495680 968148 36 11:10:01 AM 46148 1687224 97.34 20 949004 4337740 73.18 552040 925632 40 11:20:01 AM 81692 1651680 95.29 20 912512 4339880 73.21 594300 848088 284 11:30:01 AM 153660 1579712 91.14 20 832328 4344324 73.29 581208 789308 40 11:40:04 AM 13952 1719420 99.20 20 902984 5800056 97.85 976784 495092 64 Average: 159168 1574204 90.82 21 844263 4427334 74.69 559299 804256 392sar -B - kernel paging (Paging Statistics) To report paging statistics (KBs paged-in/sec, KBs paged-out/sec, pagefault/sec etc.) [root@sdbt ~]# sar -B Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/26/2023 _x86_64_ (2 CPU) 09:22:32 AM LINUX RESTART 09:30:01 AM pgpgin/s pgpgout/s fault/s majflt/s pgfree/s pgscank/s pgscand/s pgsteal/s %vmeff 09:40:03 AM 988.99 637.71 1973.99 0.98 1557.13 0.00 0.00 250.93 0.00 09:50:02 AM 1709.14 22.95 806.17 0.70 1130.43 0.00 0.00 425.93 0.00 10:00:01 AM 0.88 1.90 360.40 0.01 251.87 0.00 0.00 0.00 0.00 10:10:01 AM 0.43 2.15 362.49 0.01 253.87 0.00 0.00 0.00 0.00 10:20:01 AM 9.15 2.00 399.15 0.06 278.37 0.00 0.00 0.00 0.00 10:30:01 AM 1.11 1.74 398.36 0.00 278.74 0.00 0.00 0.00 0.00 10:40:01 AM 42.68 5.88 492.41 0.19 349.90 0.00 0.00 0.00 0.00 10:50:01 AM 0.37 2.30 473.96 0.01 354.90 0.00 0.00 0.00 0.00 11:00:01 AM 0.81 264.98 519.02 0.00 353.56 0.00 0.00 0.00 0.00 11:10:01 AM 2.95 844.28 552.75 0.01 548.56 0.00 0.00 98.89 0.00 11:20:01 AM 0.35 685.42 543.21 0.04 509.89 0.00 0.00 92.53 0.00 11:30:01 AM 0.12 52.95 501.05 0.00 400.87 0.00 0.00 0.00 0.00 11:40:04 AM 4992.36 564.49 2169.40 4.96 2259.73 0.00 0.00 1618.12 0.00 Average: 597.33 237.89 735.49 0.54 656.60 0.00 0.00 191.68 0.00Sar -dp: [root@sdbt ~]# sar -dp Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/26/2023 _x86_64_ (2 CPU) 09:22:32 AM LINUX RESTART 09:30:01 AM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 09:40:03 AM sda 32.44 1977.92 1275.41 100.29 0.27 8.20 3.51 11.37 09:40:03 AM sr0 0.01 0.06 0.00 4.00 0.00 33.11 33.89 0.05 09:50:02 AM sda 10.06 3418.28 45.90 344.40 0.24 24.35 6.94 6.99 09:50:02 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:00:01 AM sda 0.37 1.76 3.81 15.10 0.00 12.98 5.22 0.19 10:00:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:10:01 AM sda 0.42 0.77 4.30 12.12 0.01 21.18 6.14 0.26 10:10:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:20:01 AM sda 0.53 18.40 3.97 42.35 0.02 28.75 8.60 0.45 10:20:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:30:01 AM sda 0.33 2.21 3.52 17.11 0.01 39.11 10.22 0.34 10:30:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:30:01 AM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 10:40:01 AM sda 2.64 85.36 11.76 36.81 0.05 18.26 11.42 3.01 10:40:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 10:50:01 AM sda 0.36 0.73 4.61 14.97 0.00 11.22 4.67 0.17 10:50:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:00:01 AM sda 0.95 1.61 529.96 560.57 0.01 14.64 5.72 0.54 11:00:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:10:01 AM sda 2.12 5.90 1688.56 800.21 0.04 20.72 5.21 1.10 11:10:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:20:01 AM sda 1.62 0.71 1370.83 847.12 0.04 26.17 5.43 0.88 11:20:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:30:01 AM sda 0.54 0.23 105.91 195.36 0.01 15.58 4.55 0.25 11:30:01 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 11:30:01 AM DEV tps rd_sec/s wr_sec/s avgrq-sz avgqu-sz await svctm %util 11:40:04 AM sda 52.91 9984.73 1128.98 210.07 3.45 65.22 4.78 25.27 11:40:04 AM sr0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 Average: sda 8.12 1194.65 475.77 205.80 0.32 39.58 4.83 3.92 Average: sr0 0.00 0.00 0.00 4.00 0.00 33.11 33.89 0.00sar -b (aveerage disk io) [root@sdbt ~]# sar -b Linux 5.4.17-2136.318.7.2.el7uek.x86_64 (sdbt.localdomain) 10/26/2023 _x86_64_ (2 CPU) 09:22:32 AM LINUX RESTART 09:30:01 AM tps rtps wtps bread/s bwrtn/s 09:40:03 AM 32.45 29.32 3.13 1977.98 1275.41 09:50:02 AM 10.06 9.11 0.94 3418.28 45.90 10:00:01 AM 0.37 0.03 0.34 1.76 3.81 10:10:01 AM 0.42 0.04 0.38 0.77 4.30 10:20:01 AM 0.53 0.17 0.35 18.40 3.97 10:30:01 AM 0.33 0.04 0.30 2.21 3.52 10:40:01 AM 2.64 1.79 0.85 85.36 11.76 10:50:01 AM 0.36 0.02 0.34 0.73 4.61 11:00:01 AM 0.95 0.06 0.89 1.61 529.96 11:10:01 AM 2.12 0.14 1.97 5.90 1688.56 11:20:01 AM 1.62 0.04 1.57 0.71 1370.83 11:30:01 AM 0.54 0.02 0.53 0.23 105.91 11:40:04 AM 52.91 43.12 9.79 9984.73 1128.98 Average: 8.12 6.47 1.65 1194.65 475.77sar -n (network): -n { keyword [,...] | ALL } Report network statistics. Possible keywords are DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP, EICMP,TCP, ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 and UDP6.45.CRONTAB: The crontab is a list of commands that you want to run on a regular schedule, and also the name of the
command used to manage that list. MIN HOUR DOM MON DOW CMD Field Description Allowed Value MIN Minute field 0 to 59 HOUR Hour field 0 to 23 DOM Day of Month 1-31 MON Month field 1-12 DOW Day Of Week 0-6 CMD Command Any command to be executed.To find the list of jobs created: [root@sdbt ~]# crontab -l no crontab for root [root@sdbt ~]#To create new job: [root@sdbt ~]# crontab -e no crontab for root - using an empty one crontab: installing new crontab */1 * * * * touch testfilecreation ~ ~ ~ ~ -- INSERT -- [root@sdbt ~]# ls -lrt total 2936 drwxrwxr-x. 6 root root 4096 Sep 4 2021 pgbadger-11.6 -rw-------. 1 root root 2222 Mar 1 2022 anaconda-ks.cfg -rw-r--r--. 1 root root 2253 Mar 1 2022 initial-setup-ks.cfg drwxr-xr-x. 2 root root 6 Mar 1 2022 Templates drwxr-xr-x. 2 root root 6 Mar 1 2022 Downloads drwxr-xr-x. 2 root root 6 Mar 1 2022 Desktop drwxr-xr-x. 2 root root 6 Mar 1 2022 Videos drwxr-xr-x. 2 root root 6 Mar 1 2022 Public drwxr-xr-x. 2 root root 6 Mar 1 2022 Music drwxr-xr-x. 2 root root 6 Mar 1 2022 Documents drwxr-xr-x. 5 root root 39 Apr 10 2023 perl5 -rw-r--r--. 1 root root 2974369 Aug 31 15:09 v11.6.tar.gz drwxr-xr-x. 4 root root 53 Sep 21 12:20 sdbt dr-xr-xr-x. 2 root root 46 Sep 22 12:10 filecomm drwxr-xr-x. 3 root root 34 Oct 20 14:44 test -rw-r--r--. 1 root oinstall 0 Oct 25 12:18 test_file drwxr-xr-x. 3 root root 4096 Oct 25 12:18 Pictures drwxr-xr-x. 3 root root 40 Oct 25 15:42 tesdb -rw-------. 1 root root 482 Oct 25 16:47 nohup.outLIST JOBS: [root@sdbt ~]# crontab -l */1 * * * * touch testfilecreation FILE CREATED: [root@sdbt ~]# ls -lrt total 2936 drwxrwxr-x. 6 root root 4096 Sep 4 2021 pgbadger-11.6 -rw-------. 1 root root 2222 Mar 1 2022 anaconda-ks.cfg -rw-r--r--. 1 root root 2253 Mar 1 2022 initial-setup-ks.cfg drwxr-xr-x. 2 root root 6 Mar 1 2022 Templates drwxr-xr-x. 2 root root 6 Mar 1 2022 Downloads drwxr-xr-x. 2 root root 6 Mar 1 2022 Desktop drwxr-xr-x. 2 root root 6 Mar 1 2022 Videos drwxr-xr-x. 2 root root 6 Mar 1 2022 Public drwxr-xr-x. 2 root root 6 Mar 1 2022 Music drwxr-xr-x. 2 root root 6 Mar 1 2022 Documents drwxr-xr-x. 5 root root 39 Apr 10 2023 perl5 -rw-r--r--. 1 root root 2974369 Aug 31 15:09 v11.6.tar.gz drwxr-xr-x. 4 root root 53 Sep 21 12:20 sdbt dr-xr-xr-x. 2 root root 46 Sep 22 12:10 filecomm drwxr-xr-x. 3 root root 34 Oct 20 14:44 test -rw-r--r--. 1 root oinstall 0 Oct 25 12:18 test_file drwxr-xr-x. 3 root root 4096 Oct 25 12:18 Pictures drwxr-xr-x. 3 root root 40 Oct 25 15:42 tesdb -rw-------. 1 root root 482 Oct 25 16:47 nohup.out -rw-r--r--. 1 root root 0 Oct 26 17:04 testfilecreation [root@sdbt ~]# TO REMOVE CRON TAB: [root@sdbt ~]# crontab -r [root@sdbt ~]# crontab -l no crontab for root46. SCP scp stands for Secure Copy Protocol, and it is a command-line tool in Linux and Unix-like operating
systems that allows you to securely transfer [oracle@tesdb1 ~]$ vi sample [oracle@tesdb1 ~]$ ll total 12 -rw-r--r--. 1 oracle oinstall 221 Oct 20 01:19 db.env drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Desktop drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Documents drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Downloads -rw-r--r--. 1 oracle oinstall 226 Oct 20 01:24 grid.env drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Music drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Pictures drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Public -rw-r--r--. 1 oracle oinstall 14 Oct 26 07:53 sample drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Templates drwxr-xr-x. 2 oracle oinstall 6 Oct 19 00:59 Videos [oracle@tesdb1 ~]$ scp sample root@192.168.1.101:/root The authenticity of host '192.168.1.101 (192.168.1.101)' can't be established. ECDSA key fingerprint is SHA256:9VHVB8UFkC7vGeeqa48NWPjwfXpA0YVHD6LFGXZBlAE. ECDSA key fingerprint is MD5:d8:bd:02:94:74:1a:b0:17:e9:d0:ea:27:4b:ce:46:e5. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.101' (ECDSA) to the list of known hosts. root@192.168.1.101's password: sample 100% 14 5.4KB/s 00:0047. SCP SH, or Secure Shell, is a cryptographic network protocol that provides a secure way to access and manage remote systems. It is commonly used on Linux and other Unix-like operating systems for secure remote access, file transfers, and remote command execution. Here are some key aspects of using SSH in Linux: [oracle@tesdb1 ~]$ ssh root@192.168.1.101 root@192.168.1.101's password: Last login: Thu Oct 26 13:42:59 2023 [root@sdbt ~]# logname Root [root@sdbt ~]# ll total 2940 -rw-------. 1 root root 2222 Mar 1 2022 anaconda-ks.cfg drwxr-xr-x. 2 root root 6 Mar 1 2022 Desktop drwxr-xr-x. 2 root root 6 Mar 1 2022 Documents drwxr-xr-x. 2 root root 6 Mar 1 2022 Downloads -rwxr-xr-x. 1 root root 32 Oct 12 15:39 f1 dr-xr-xr-x. 2 root root 46 Sep 22 12:10 filecomm -rw-r--r--. 1 root root 2253 Mar 1 2022 initial-setup-ks.cfg drwxr-xr-x. 3 root root 46 Oct 10 16:08 kri drwxr-xr-x. 2 root root 4096 Sep 13 12:38 krishna drwxr-xr-x. 2 root root 6 Mar 1 2022 Music -rw-------. 1 root root 482 Oct 25 16:47 nohup.out drwxr-xr-x. 5 root root 39 Apr 10 2023 perl5 drwxrwxr-x. 6 root root 4096 Sep 4 2021 pgbadger-11.6 drwxr-xr-x. 3 root root 4096 Oct 25 12:18 Pictures drwxr-xr-x. 2 root root 6 Mar 1 2022 Public -rw-r--r--. 1 root root 14 Oct 26 17:24 sample drwxr-xr-x. 4 root root 53 Sep 21 12:20 sdbt drwxr-xr-x. 2 root root 6 Mar 1 2022 Templates drwxr-xr-x. 3 root root 40 Oct 25 15:42 tesdb drwxr-xr-x. 3 root root 34 Oct 20 14:44 test -rw-r--r--. 1 root oinstall 0 Oct 25 12:18 test_file -rw-r--r--. 1 root root 0 Oct 26 17:16 testfilecreation -rw-r--r--. 1 root root 2974369 Aug 31 15:09 v11.6.tar.gz drwxr-xr-x. 2 root root 6 Mar 1 2022 Videos [root@sdbt ~]# ls -lrt|grep sample -rw-r--r--. 1 root root 14 Oct 26 17:24 sample [root@sdbt ~]# hostname -i 192.168.1.101 [root@sdbt ~]# exit logout Connection to 192.168.1.101 closed. [oracle@tesdb1 ~]$ hostname -i 192.168.1.121 [oracle@tesdb1 ~]$ cat sample sample work ☛ Join to Learn from Experts: Oracle DBA Training In Chennai by TesDBAcademy
Next Topic »
(Alert Log Monitoring) |