Backslash Tricks
Let’s take an example, On our desktop, we have a “Backslash Folder” in this folder we also have 1 to 50 folders and the first Folder also has 1 to 50 fifty folders. Sometimes It’s very tedious work to type every folder name so we can solve this problem by backslash and asterisk. See the Syntax
Syntax
cd SourceFolder/*/Destination Folder
Example
cd 1/*/50
Output
You can see directory read-write permission without changing the current working directory using backslash
ls -l /directory_name/*
Bash Pathname Expansion in Linux
When you type a command and press enter, bash performs several processes upon the text before carrying out our command as a command. The process that makes this happen is called expansion. For example, suppose you use the echo command for standard output.
echo hi Output hi
If you use echo with asterisk wildcard echo will print your directory. Suppose you have two files in the current working directory. The first file name is file1.txt and file2.txt then you will use echo with asterisk wildcard then It will print your directory name.
Example:
Types of Expansion
- Pathname Expansion
- Tilde Expansion
- Arithmetic Expansion
- Brace Expansion
- Parameter Expansion
- Command Substitution