Linux Advanced Functions And Commands

Rating: 4
Views: 5103
by Sandeep
Last modified: March 9th 2021

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: "Linux Certification Training" This course will help you to achieve excellence in this domain.

Linux Advanced Functions And Commands

Looking up files

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:

Command

We can solve this problem by commanding the full path to run. Alternatively, we can re-export the content of the variable path:

                                     variable path

Frequently asked Linux Interview Questions & Answers 2021

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'

Finding and locating files

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 ]

find  -name

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.

Linux training Hyderabad, Linux training Bangalore

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 

List of Other Linux Courses:

 Red Hat Certified Engineer  Linux Security Fundamentals
 Linux Networking  Linux Administration
 Linux Cluster  IBM LinuxONE

 

List of Other Linux Blogs:

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