Mastering Linux Command Line: A Guide to Essential Commands Part 3

Linux command line can be a powerful tool for developers and testers alike. In this guide, we’ll explore some essential commands that can help you navigate and manipulate files, directories, and permissions with ease.

Let’s start with file management. Imagine you have three text files: promo.txtlucky.txt, and pra.txt. To delete all text files in a directory, you can use the rm command with a wildcard (*) like so: 

rm -rf *.txt
This command will remove all files ending with .txt. The wildcard acts as a placeholder for any matching file names.

Moving files is just as straightforward. Suppose you want to move a file named move_to_pop.txt into a directory called pop. You would use the mv command as follows:
mv move_to_pop.txt pop/
The mv command takes two arguments: the source file and the destination. In this case, move_to_pop.txt is moved into the pop directory.


Copying files is similar to moving them. If you want to copy promo.txt into the pop directory, you would use the cp command:
cp promo.txt pop/
Now, promo.txt will be copied into the pop directory, and the original file will remain in
its current location.

Finding files is another common task. The find command is versatile and can search for files based on various criteria. For example, to find all text files in the current directory, you could use:
find . -name “*.txt”
The . indicates the current directory, and -name specifies the search pattern. The asterisk (*) is a wildcard that matches any characters.


If you need to search within files for specific text patterns, the grep command is incredibly useful. Say you want to find all occurrences of the word “vim” in promo_one.txt:
grep “vim” promo_one.txt
This will output all lines containing the word “vim” from the file promo_one.txt. The -i option can be added to ignore case sensitivity, and -c will count the number of matches instead of listing them.


Now, let’s talk about permissions. In Linux, file permissions determine who can read, write, or execute a file. The chmod command is used to change these permissions. For instance, to give read and write permissions to a file for the owner and group, you would use:
chmod u+rw,g+rw filename.txt

Here, u stands for the user (owner) and g for the group. +rw adds read and write permissions.

To remove write permissions, you would use:
chmod u-w,g-w filename.txt

Understanding and managing permissions is crucial, especially in production environments where you might only have read-only access.

In conclusion, mastering these Linux commands can significantly enhance your productivity and efficiency. Whether you’re a developer, tester, or system administrator, these commands are indispensable tools in your arsenal. Remember, the best way to learn is by doing, so don’t hesitate to experiment and explore the vast capabilities of the Linux command line.

Are you ready to take the first step towards becoming a successful automation tester? Let’s embark on this exciting journey together!  Join our new batch at Use Code “PROMODE” for 10% OFF!” We’re starting a new batch soon





Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.