Using the shell features as discussed in MOVING FILES, we had looked at using the shell feature to manipulate multiple files in one instance. In the example, the shell automatically found out what the user meant by the requirements between the square braces “[” “]”.
Coincidentally, the shell can substitute a range of numbers, lower and upper case characters, and as many characters as you want with an asterisk. You can use many substitutions simultaneously because the shell handles these substitutions very logically.
For instance, the bash shell finds no problems with expressions such as the ls dirname/*/*/*[2-3]. However, in other shells, we use the asterisk to minimize the efforts of typing. For instance, instead of entering the cd directory, you enter the cd dir*.
In the Bash GNU, this is not necessary because the shell has a feature called filename completion which makes it possible to type the first few characters of a command and the shell finds what you are looking for. For instance, in a directory full of files, you can search for files beginning with the letter A by typing Is A and double pressing the tab key rather than the enter key.
Let us have a look at some of the LINUX ADVANCED AND FUNCTIONS AND COMMANDS.
If you want to enrich your career and become a professional in Linux, then visit Mindmajix - a global online training platform: "" This course will help you to achieve excellence in this domain.
The simplest way to search for files is by the help of which command to search for directories indexed in the user search path. The path only contains files or directories containing executable files or programs, which makes the “which” command redundant. The “which” command is especially convenient when diagnosing “command not found”.
[ Related Article: Linux Monitoring Tools for Servers ]
Let us look at an example where our user “john” cannot use the acroread program, while a colleague of his has no problems with the program on the same system. The colleague tells John that he can see the program in /opt/acroread/bin but the directory is not in the path:
We can solve this problem by commanding the full path to run. Alternatively, we can re-export the content of the variable path:
The command (the which command) also checks whether the command is an alias for another command:
gerrit:~> which -a ls ls is aliased to `ls -F --color=auto' ls is /bin/ls
If the above command does not work, you can use the alias command
tille@www:~/mail$ alias ls alias ls='ls --color'
The find tool is the real tool to use when searching for directories that are not in the path. It is a very powerful tool, but most users consider it a somewhat difficult syntax. The GNU find on the other hand handles syntax problems. The command allows you to search file names and access file sizes, dates of change, and almost all the other file property changes.
[ Related Article: Reasons Why You Should Learn Linux ]
This means to look in all subdirectories and files in the specified path and print a list of all the files with a name of the search criteria (string name and not the content), you can use the search command to search for files of a certain size. For example, let us assume our user john wants to find files larger than 5MB:
john:~> find . -size +5000k psychotic_chaos.mp3
If you are interested to learn Linux and become a certified developer in it. Then check out our certified Linux training courses near your cities.
These courses are incorporated with live instructor-led training, industry use cases, and hands-on live projects. This training program will make you an expert in Microsoft Azure and help help you to achieve your dream job
|Red Hat Certified Engineer||Linux Security Fundamentals|
|Linux Networking||Linux Administration|
|Linux Cluster||IBM LinuxONE|
|Linux File Permissions||Introduction to Linux Operating System|
|Linux Networking Commands with Examples||Top 10 Reasons Why You Should Learn Linux|
|What is Linux?||Linux Kernel Tutorial|
|What is Linux Operating System?||Linux Commands for Beginners|
Stay updated with our newsletter, packed with Tutorials, Interview Questions, How-to's, Tips & Tricks, Latest Trends & Updates, and more ➤ Straight to your inbox!
|Linux Training||Jan 28 to Feb 12|
|Linux Training||Jan 31 to Feb 15|
|Linux Training||Feb 04 to Feb 19|
|Linux Training||Feb 07 to Feb 22|
Sandeep is working as a Senior Content Contributor for Mindmajix, one of the world’s leading online learning platforms. With over 5 years of experience in the technology industry, he holds expertise in writing articles on various technologies including AEM, Oracle SOA, Linux, Cybersecurity, and Kubernetes. Follow him on LinkedIn and Twitter.
Copyright © 2013 - 2023 MindMajix Technologies