A technical troubleshooting blog about Oracle with other Databases & Cloud Technologies.

Linux Operating System 2.

3 min read

File Permissions

The “umask” command can be used to read or set default file permissions for the current user. The umask value is subtracted from the default permissions (666) to give the final permission:

666 : Default permission
022 : - umask value
644 : final permission

The “chmod” command is used to alter file permissions after the file has been created:

Owner      Group      World      Permission
=========  =========  =========  ======================
7 (u+rwx)  7 (g+rwx)  7 (o+rwx)  Read + Write + Execute
6 (u+wx)   6 (g+wx)   6 (o+wx)   Write + Execute
5 (u+Rx)   5 (g+Rx)   5 (o+Rx)   Read + Execute
4 (u+r)    4 (g+r)    4 (o+r)    Read 
2 (u+w)    2 (g+w)    2 (o+w)    Write 
1 (u+x)    1 (g+x)    1 (o+x)    Execute 
-rw-r--r--.  1 oracle oinstall    0 Sep 20 19:29 new_file

[root@dg11 app]# chmod 775 new_file 

[root@dg11 app]# ls -ltrh
total 4.0K
-rwxrwxr-x.  1 oracle oinstall    0 Sep 20 19:29 new_file

The “chown” command is used to change the ownership of files after creation. The “-R” flag causes the command ro recurse through any subdirectories.

-rwxrwxr-x.  1 oracle oinstall    0 Sep 20 19:29 new_file

[root@dg11 app]# chown -R root:root new_file 

[root@dg11 app]# ls -ltrh
total 4.0K
-rwxrwxr-x.  1 root   root        0 Sep 20 19:29 new_file

OS Users Management

The "useradd" command is used to add OS users:

useradd -G oinstall -g dba -d /usr/users/grid -m -s /bin/ksh grid

The "-G" flag specifies the primary group.
The "-g" flag specifies the secondary group.
The "-d" flag specifies the default directory.
The "-m" flag creates the default directory.
The "-s" flag specifies the default shell.

The “userdel” command is used to delete existing users. The “-r” flag removes the default directory.

userdel -r oracle

The “passwd” command is used to set, or reset, the users login password:

[root@dg11 app]# 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.

The “ps” command lists current process information.

[root@dg11 app]# ps -ef|grep ora
oracle    2279     1  0 18:15 ?        00:00:00 /usr/bin/gnome-keyring-daemon --daemonize --login
oracle    2285  2268  0 18:15 ?        00:00:00 /usr/libexec/gnome-session-binary --session gnome-classic
oracle    2294     1  0 18:15 ?        00:00:00 dbus-launch --sh-syntax --exit-with-session

Specific processes can be killed by specifying the process id in the “kill” command, the -9 forces to kill that process.

kill -9 <PID>
kill -9 2279

Hostname & IP Address

[root@dg11 app]# hostname
dg11.localdomain

[root@dg11 app]# hostname -i
192.168.56.71

Information on RAM and CPU’s

The free command let you identify the among of memory used by all the apps on the box. If the amount of  memory used is bigger than the available RAM, then the box starts to swap.
If you use this command with the -m option, it will show the numbers in MB & -g option, it will show the numbers in GB.

[root@dg11 app]# grep MemTotal /proc/meminfo 
MemTotal:        2768368 kB

[root@dg11 app]# free -g
              total        used        free      shared  buff/cache   available
Mem:              2           1           0           0           1           0
Swap:             2           0           2

Shows the percentage of used memory:

[root@dg11 app]# free -m | grep Mem | awk '{print ($3 / $2)*100}'
41.1395

Shows the percentage of swap memory:

[root@dg11 app]# free -m | grep -i Swap | awk '{print ($3 / $2)*100}'
1.43276

Show CPU(s) info

[root@dg11 app]# grep MemTotal /proc/meminfo 
MemTotal:        2768368 kB

[root@dg11 app]# grep "model name" /proc/cpuinfo 
model name	: AMD Ryzen 5 5500U with Radeon Graphics

[root@dg11 app]# cat /proc/cpuinfo
cpu cores	: 1

[root@dg11 app]# nproc
1

Network Information

Display network interface configuration parameters

[root@dg11 app]# ifconfig -a

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::6ca2:faf5:af66:bf5f  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:85:b6:fc  txqueuelen 1000  (Ethernet)

/etc/hosts  File

[root@dg11 app]# cat /etc/hosts
192.168.56.72   db11db.localdomian      db11db
192.168.56.71   dg11.localdomain        dg11

Server Uptime:

[root@dg11 app]# uptime
 20:39:27 up  2:24,  4 users,  load average: 0.09, 0.10, 0.09

Hope it helped !! 🙂