Monday, February 17, 2025

Basic Linux

# Home directory symbol
cd ~       # Goes to the user's home directory

# User home directory symbol (for specific user)
cd ~username  # Goes to the home directory of a specific user

# Print the home directory path
echo $HOME    # Prints the home directory path

# Use the tilde (~) symbol with other commands
ls ~      # List contents of the user's home directory


# Root user symbol
# When logged in as root, the prompt typically shows a `#`
# For example, root user prompt might look like this: 
# root@hostname:~#

# Regular user symbol
# When logged in as a regular user, the prompt typically shows a `$`
# For example, regular user prompt might look like this: 
# username@hostname:~$

# Switch to root user using sudo (if the user has sudo privileges)
sudo su    # Switch to root user

# Run a command with root privileges using sudo
sudo command   # Example: sudo apt-get update

# Switch to another user
su username    # Switch to another user (without needing sudo)

# Display the current user
whoami         # Shows the current logged-in user



# List directory contents
ls -l    # Long listing format
ls -a    # Show hidden files

# Print working directory
pwd

# Change directory
cd /home/user/Documents
cd ..    # Move up one directory

# Create a new directory
mkdir myfolder

# Remove an empty directory
rmdir myfolder

# Remove files or directories
rm file.txt
rm -r myfolder   # Remove directory and its contents

# Copy files and directories
cp file1.txt file2.txt
cp -r dir1 dir2   # Copy directory

# Move or rename files
mv oldname.txt newname.txt
mv file.txt /home/user/Documents

# View file contents
cat file.txt

# View file contents one page at a time
less file.txt

# Show the first 10 lines of a file
head file.txt

# Show the last 10 lines of a file
tail file.txt
tail -f log.txt  # Continuously watch a file

# Change file permissions
chmod 755 script.sh

# Change file owner
chown user:group file.txt

# Show running processes
ps aux

# Show real-time system resource usage
top

# Terminate a process
kill PID

# Kill processes by name
pkill firefox

# Check network connectivity
ping google.com

# Display network interfaces
ifconfig
ip a

# Download files from the internet
wget http://example.com/file.zip

# Check disk space usage
df -h

# Check file/directory size
du -sh foldername

# Show current user
whoami

# Show logged-in users
who

# Change user password
passwd

# Show system information
uname -a

# Show system uptime
uptime

# Show command history
history

# Restart or turn off the system
reboot
shutdown -h now



Check Physical Memory
 (At least 1GB of physical Memory (RAM) is required. EX: 2059516 kB) 
 
$ grep MemTotal /proc/meminfo

Check Swap Space.
(RAM is 2GB, so you have 3GB of Swap Size EX: 3148732 kB)
 
$ grep SwapTotal /proc/meminfo

If you don’t have a swap size 3gb. so you need to add one more swap file.

Check space available in /tmp
(You need to have at least 150M to 200M of space in the /tmp directory.)
 
$ df -h /tmp


Disk space requirements in /U01
(You need to have at least 10BG to 20GB of space in the /U01 directory.)
 
# df -h /u01


Last login: Mon Feb 17 18:47:59 2025

[root@db19c ~]# grep MemTotal /proc/meminfo

MemTotal:        5757372 kB

[root@db19c ~]# grep SwapTotal /proc/meminfo

SwapTotal:      16777212 kB

[root@db19c ~]# df -h /tmp

Filesystem          Size  Used Avail Use% Mounted on

/dev/mapper/ol-tmp  5.0G   84M  5.0G   2% /tmp

[root@db19c ~]# df -h /u01

Filesystem          Size  Used Avail Use% Mounted on

/dev/mapper/ol-u01   30G   13G   18G  42% /u01

If u want to connect to TOAD
Find the ip address using   
$ip addr

[root@db19c ~]# ip addr


Enable Arrow Key Navigation in SQL*Plus using rlwrap

# dnf install -y epel-release
# yum install -y rlwrap
rlwrap sqlplus / as sysdba




No comments:

Post a Comment

 https://www.linkedin.com/pulse/building-real-time-database-monitoring-dashboard-oracle-khaleeq-tpwxf/