Mastering Linux Commands and Productivity Tips on RHEL 9
Designed by Ddhruv Arora

Mastering Linux Commands and Productivity Tips on RHEL 9

Introduction

Linux is a powerful operating system known for its versatility and robustness. If you're running Red Hat Enterprise Linux 9 on a virtual machine, you have access to a wealth of commands and tools to enhance your productivity. In this blog, we'll explore a wide range of commands, shortcuts, and productivity tips that will help you make the most of your Linux experience on the RHEL 9 graphical user interface (GUI).

1. Working with Dates and Calendars

Linux makes it easy to work with dates and calendars. You can use the date command to display the current date and time. Additionally, you can use the cal command to generate a calendar for a specific month and year.

date and cal


2. Browsing the Web with Firefox

Need to access the internet? Simply launch the Firefox web browser from the GUI, use firefox&

Firefox


3. Managing Processes

- Ctrl + C: Stop a running process.

- Ctrl + Z: Pause a program and move it to the background.

- fg: Bring a paused program back to the foreground.

- command &: Run a command in the background while keeping it in a running state.


4. Text Editing with Gedit

Gedit is a user-friendly GUI-based text editor for creating and editing files.

use the command gedit to start it.

Gedit


5. Running Commands Independently with Nohup

Use the nohup command to run Linux commands independently, ensuring that closing the terminal won't terminate the program.

Example: nohup firefox


6. Terminal Shortcuts

- Ctrl + S: Hide input in the terminal.

- Ctrl + Q: Show hidden input.

- Ctrl + L: Clear the terminal screen.

- Ctrl + U: Remove the entire command line.


7. Taking Screenshots

Capture your screen or specific windows using the gnome-screenshot command, and customize it with options like -f and -d, alternatively, you can use the print-screen key as well.

Screenshots Taken


8. File Management

- ls and dir: Listing files and directories.

- cd: Change the current directory.


9. Viewing Images

Open images in the default image viewer with the eog command.

opening the screenshot using eog


10. Creating and Editing Files with Vim

Create, edit, and secure text files with the Vim text editor.

- Create a file using vim <file_name>

- Use ‘i’ to insert text in the file

-?Use ‘:wq’ to save and quit

-?Use vim +X <file_name> to make it password protected

Creating a file with encryption in VIM


11. Automate Tasks with Cron

Use crontab to schedule tasks at specified times.

The format for scheduling is: min hour date month dayofweek command.

The command used crontab -e will open the cron job file.


12. Finding the Right Command

Use apropos to find commands based on keywords, making it easier to discover the right command for your task.

apropos with copy file


13. Accessing Manual Pages

Access comprehensive manual pages for commands using the man command, press q to quit.

MAN for CP (copy) command


14. Command History

Review your command history using the history command.

history command

16. Reading Files with cat

Display the contents of a file using the cat command.

Reading file with cat command


17. Fun with Cowsay

Add a touch of humor to your terminal with the cowsay command.

To install use: yum install -y cowsay, then use the following command

cowsay Hello hi        
cowsay hello


18. Configuring Package Management with Yum

Set up Yum for package installation and management.

firstly navigate to /etc/yum.repos.d/

cd /etc/yum.repos.d/        

create a file named "yumlocal.repo"

vim yumlocal.repo        

Add the following lines:

yum local config

The yum in now configured, make sure that OS Dvd is mounted.


19. Installing the "fuck" Environment

Enhance your command-line experience with the "fuck" tool, making it easy to correct mistyped commands.

firstly install it using pip3 as shown,

pip3 install thefuck        

then, start the fuck env, type in fuck twice on cmd to start it.

now, just use thefuck before any command and it will be ready to help you

Example usage:

theFuck correcting the command


20. Keyboard Bindings

Explore and manage keyboard bindings with the bind -p command.

top 5 keyboard bindings


21. File Transfer with Rsync

Consider using rsync as an alternative to the SCP command for efficient file transfers, also it provides tons of options like key logging, tracking, etc.

rsync command options


22. Identifying the Current User

Use whoami to display information about the current user.

I am Root


23. User Management

- To add a new user we can use “useradd <user_name>” and to set the password use "passwd <user_name>" command

- To lock a user from root account use passwd -l <user_name>

-?To unlock the user use passwd -u <user_name>

-??chpasswd ?to update multiple passwords together, use the notation user_name:password and to exit use ctrl + D

jack:redhat?????         

Example:

Added a new user


24. Working with Text-to-Speech

Utilize the espeak-ng command for speech synthesis.

Example usage, to get current date as output:

date | espeak-ng        

25. Combining Commands with Pipes

Combine multiple commands using the pipe (`|`) operator to create powerful data processing pipelines.

Example, finding specific file with combination of ls and grep:

 ls | grep test.txt        

Output:

finding file with GREP


26. System Information with "last"

Access detailed system login information using the last command.

Example:

The Logs


27. Networking and IP Address

Retrieve IP address information with the ifconfig command and discover your public IP address with curl ifconfig.me

Get private IP address using:

ifconfig        

The expected output:

Private IP


Get the public IP address info:

curl ifconfig.me        

The expected output:

Public IP


28. Creating ASCII Art

Transform text into eye-catching ASCII art with the figlet command.

Example:

figlet hi        

Output:

Dashed Hello


29. Monitoring with "watch"

Automate the execution of commands at specified intervals using the watch command.

Example: Creating a real-time digital watch, use the following command:

watch -t -n1 "date +%T | figlet"        

Output:

Watch using Watch


30. Tracking User Activity

Check user logins and usage using the who and ac commands.

- To see the user accounting day we can use “ac -d”

- To see the user-wise accounting we can use “ac -p”

- We can also combine them “ac -d -p”

The accounting and time


31. Enhancing Authentication Security

Use authconfig to manage user authentication and faillock settings.

Firstly install it using:

yum install authconfig        

- To lock the user on failed password attempts and unlock them after 24hrs or so we can use the following command:

authconfig –enablefaillock –faillockargs=”deny=3 unlock_time=60” –update        

- to check for failed attempts use: faillock on root account

- to manually unlock the locked account, use

faillock --user <user_name> --reset        

32. Process Management

Monitor and manage running processes with the ps command and sort them with various options.

Example:

ps -aux        

Output:

List of ongoing processes


33. Searching Text with "grep"

Find text patterns in files and directories using the versatile grep command.

Example: Finding the IPv4 and IPv6

Finding IPs


34. Disk Usage Information

Check disk space usage with the df command and also get other valuable insights.

About disk


35. Finding Large Files

Locate large files with the find command.

The command:

find -type f -size 100M        

So, on my system, there is no file larger than 100Mb, so I reduced it to 10Mb for the demo, and here is the output:

Files larger than 10Mb


36. Explore Telehack

Discover Telehack for an online Linux terminal experience.

Telehack Website


Conclusion

Mastering these Linux commands and productivity tips will greatly enhance your experience when running Red Hat Enterprise Linux 9 with a graphical user interface. Whether you're a beginner or an experienced Linux user, these tools and shortcuts can streamline your workflow, boost productivity, and make your Linux journey more enjoyable and efficient.


Thank you for reading this article, hope you liked it!

V M SAI PREM TAMMANA

Silicon CAD Engineer CW@Meta Inc. | Linux | Python | Machine Learning | Artificial Intelligence | Perl | Make | TCL | JAVA | BASH

1 个月

Thank you

回复
Himanshu Kumar

R&I Engineer || 2x RedHat Certified || Logic App || Function App || Azure DevOps || Full Stack Developer || Cloud Computing || Containerization || Kubernetes || Data Science || Shell Scripting

1 年

Great work

要查看或添加评论,请登录

Ddhruv Arora的更多文章

社区洞察