Examples of the expr Command in Shell

Overview of expr The expr command is used for integer arithmetic and string operations (like length and pattern matching) in shell scripts. 1. Syntax and Basic Usage Only integer arithmetic is supported. Operators and numbers must be separated by spaces; otherwise, errors occur. The multiplication operator (*) must be escaped. When using expr i ...

Posted on Sat, 09 May 2026 13:26:19 +0000 by danoli3

Essential Linux Command Line Operations for System Navigation and File Management

Navigating the Filesystem pwd Command pwd Displays the absolute path of the current working directory. cd Command cd [target_directory] Changes the current shell session's working directory. Usage: cd ..: Move up to the parent directory. cd /home/user/docs: Navigate using an absolute path (starts from root /). cd ../projects: Navigate using ...

Posted on Sat, 09 May 2026 03:41:05 +0000 by y_oda2002

Essential Linux Commands for Filesystem Navigation and Management

pwd: Print Working Directory The pwd utility outputs the absolute path of the current working directory. It is primarily used to verify your location within the filesystem hierarchy before executing path-dependent operations. Syntax pwd [options] Usage Example $ cd /var/log/nginx $ pwd /var/log/nginx cd: Change Directory The cd command ...

Posted on Fri, 08 May 2026 17:05:41 +0000 by webtuto

Advanced Shell Variable Operations

Variable Deletion and Replacement Removing Prefix Patterns Removing the shortest matching prefix pattern using #: greeting="Hello World, Welcome to Shell" echo $greeting greeting_clean=${greeting#*or} echo $greeting_clean Removing the longest matching prefix pattern using ##: greeting_long=${greeting##*or} echo $greeting_long String ...

Posted on Fri, 08 May 2026 14:00:10 +0000 by netpants