Linux commands: Understanding and Using `umask`

A comprehensive guide to the umask command, its functionality, and how to effectively set default file permissions. When creating a file, it is not always necessary to specify permissions right away, as default permissions are assigned. These default permissions can be controlled and modified using the umask command. To check the current umask value, simply type umask without any arguments. The command will display the current umask value, such as 0022....

Linux Commands: Understanding the `type` Command

In the world of Linux commands, the type command plays a crucial role in determining the nature of a command. It helps identify whether a command is an executable, a shell built-in program, a shell function, or an alias. Let’s explore each of these types: Executable: An executable refers to a standalone program that can be executed directly. Shell Built-in Program: These are commands that are built into the shell itself....

Linux Commands: Using `sudo` to Run Commands as Another User

In the Linux operating system, the sudo command is commonly used to run a command as another user, most notably as the root user. This allows for the execution of privileged operations that require administrative permissions. To use sudo, you must have it enabled on your system. Once enabled, you can run commands as root by entering your user’s password (not the root user password). This provides an extra layer of security....

Linux Commands: whoami

In this guide, we will explore the whoami command, which is used to print the current user name. This command works on Linux, macOS, WSL, and any UNIX environment. How to Use the whoami Command To print the user name currently logged in to the terminal session, simply type whoami and press Enter. Here’s an example: $ whoami john_doe Note: The whoami command should not be confused with the who am i command, which provides more detailed information....

linux-command-which

Today, I’m going to give you a quick guide on how to use the which command in Linux. The which command is very useful when you want to locate the path of a specific command. Let’s say you have a command that you can execute in the shell because it’s in the shell path, but you’re curious about its location. In this case, you can use the which command to find out where it is stored....

The cd Command: A Quick Guide to Changing Folders in Linux

The cd command in Linux is a powerful tool used to change directories or move into different folders within a file system. Understanding how to navigate through folders is essential for efficient file management. In this blog, we will explore the cd command and various ways to use it effectively. Basic Usage The cd command, short for “change directory,” is invoked by specifying the folder you want to move into. This can be done by providing either the folder name or the complete path to the folder....

Working with Duplicate Records/Lines in Text: A Quick Guide to the `uniq` Command

The uniq command is a powerful tool used for sorting lines of text and working with duplicate records. Whether you need to extract duplicate lines from a file or process the output of another command using pipes, uniq has got you covered. To get started with uniq, keep in mind that it detects adjacent duplicate lines by default. This means that combining it with the sort command will yield the best results:...