It's a tech blog!

Mastering the Linux Terminal: Beyond the Basics

By Marcelo Vieyra, November 26th 2023 | 4 mins, 757 words

In our previous post, Exploring the Basics of Linux Terminal Commands , we embarked on a journey through the fundamental Linux terminal commands, laying the groundwork for a solid understanding of command line interaction. Now, it's time to delve deeper into the command line ecosystem and explore more advanced concepts that will elevate your Linux proficiency.

File Manipulation Mastery

find - Search for Files

Take your file management skills to the next level with the find command. Locate files based on various criteria such as name, type, or size.

find /path/to/search -name filename

grep - Search Inside Files

Unlock the power of pattern matching with grep. Search for specific patterns within files.

grep "pattern" filename

Working with Permissions

chmod - Change File Permissions

Understanding and managing file permissions is crucial. Use chmod to modify the access permissions of a file.

chmod permissions filename

Common chmod Options:

  • -c: Report only when a change is made.
  • -v: Be verbose, showing files as they are processed.
  • -R: Recursively change permissions of directories and their contents.

Permission Types:

  • Read (r): Allows reading of the file or viewing the contents of a directory.
  • Write (w): Allows modification of the file or the addition/removal of files within a directory.
  • Execute (x): Allows the execution of a file or access to a directory.

Permission Scope:

  • Owner (u): The user who owns the file.
  • Group (g): The group associated with the file.
  • Others (o): All others who are neither the owner nor in the group.
chmod +x  # Add execute permission for the owner
chmod -R 755 directory/  # Give read, write, and execute permissions to the owner, and read and execute permissions to others
chmod u=rw file.txt  # Give the owner read and write permissions
chmod go-rwx file.txt  # Remove all permissions for the group and others

In the examples above, + is used to add permissions, and - is used to remove permissions. The three digits in chmod represent the owner, group, and others, with the numbers corresponding to read (4), write (2), and execute (1). So, 755 gives the owner read, write, and execute permissions, and read and execute permissions to the group and others.

This level of control over file permissions ensures a secure and efficient environment for your files and directories. Experiment with different combinations to tailor access to your specific needs.

chown - Change Ownership

Change the owner of a file or directory with the chown command.

chown new_owner:new_group filename

Common chown Options:

  • -c: Report only when a change is made.
  • -v: Be verbose, showing files as they are processed.
  • -R: Recursively change ownership of directories and their contents.

Changing Ownership:

  • Owner (new_owner): The new user who will own the file or directory.
  • Group (new_group): The new group associated with the file or directory.


chown user1:group1 file.txt  # Change the owner to user1 and the group to group1
chown -R user2: directory/  # Change the owner of the directory and its contents recursively
chown :new_group file.txt  # Change only the group, leaving the owner unchanged

In the examples above, the chown command is used to change both the owner and group of a file or directory. The -R option is used for recursive changes.

Ownership changes are particularly useful when managing shared directories or transitioning ownership after user accounts are modified. Remember to use these commands with caution, especially when altering ownership at the system level.

Text Processing Tools

sed - Stream Editor

Manipulate text streams using the sed command. It's a powerful tool for text transformations.

sed 's/old_pattern/new_pattern/' filename

awk - Text Processing

Master text processing with awk. It excels at extracting and reporting on data patterns.

awk '/pattern/' filename

System Monitoring

top - Monitor System Activity

Keep an eye on system processes and performance in real-time using the top command.


htop - Enhanced System Monitoring

For a more user-friendly system monitoring experience, try the htop command.


Package Management

apt - Package Management on Debian-based Systems

Streamline software installation and updates with the apt package manager.

sudo apt update
sudo apt install package_name

yum - Package Management on Red Hat-based Systems

If you're on a Red Hat-based system, use the yum package manager.

sudo yum update
sudo yum install package_name

Shell Scripting

Writing Your Scripts

Extend the capabilities of the command line by writing your shell scripts. Automate repetitive tasks and unleash your creativity.

# Your script here

This is just a glimpse into the expansive world of Linux terminal commands. As you continue your journey, don't hesitate to experiment, explore, and embrace the power of the command line. The terminal is your gateway to a world of efficiency and control.