- 1 How to Find a File in Linux using Linux Commands
How to Find a File in Linux using Linux Commands
I still remember when I first get introduced to UNIX and Linux environment way back to two-decade back in 1999 after few days of initial training in the office I have been placed at the customer site as a resident engineer.
Even though I have some kind of earlier experience almost two years managing government sector client for desktop and printer support via some AMC vendor handling many AMC for government sector clients in New Delhi around 1997-1999.
I have been searching for some kind of server level support at that moment so I landed on the same. So area and environment I have been assigned having SCO UnixWare and Red Hat Linux remember it was not RHEL that time and no internet awareness at that time.
Google Baba was born but still a child and somehow Yahoo was even more popular at that moment as per my experience and understanding.
Please refer here if you want to learn more about linux in terms of linux e-books.
It was the time and era when most of the government sector getting introduced to computerization. Some of them already introduced with some digital products but they were not introduced to computerization.
So let us come to my experience about linux commands on the first site I have been provided support with senior with me.
I & Senior have installed one server each and with help of senior and make that branch live completely one server live at moment and one as standby as Redundancy policy in case of any h/w failures.
Please refer here if you want to learn more about linux in terms of linux print books.
They were LAN-based not connected to the internet. Desktops either having DOS or Windows95 and VXL Terminals directly connected either via Ethernet or Serial Cables to distribute server connections at different counters in the local office.
We have made branch online till Friday as Computerization Opening was scheduled on Monday. We have been requested to stay till successful opening as it was a grand thing at that time.
So finally all went well and we both have been appreciated well. So before me and my senior disbursed to each other I used to make a note of whatever help I have asked.
Please refer here if you want to learn more about linux in terms of linux video courses.
Finally, I allow him to report office back and now it was my turn to handle all the installation and I have been asked I can handle it alone and happily, I have confirmed in yes as I have some shorts of live experience which I consider was sufficient at that moment.
So with approval and expected date of new branch opening I have been tasked to make new branch online, I visited new branch having a day spare as part of planning if something goes against we will have time to recover.
If you are working to get the azure certification you can refer to azure certification preparation books.
Actually, all went well in terms of the installation of servers and connectivity. The branch was almost live with everything except 8 logins we need to create for 8 separate departments and eight counters.
I have created all 8 users as per my notes made during my previous installation experience. As per my experience till that time I have done everything as I did during my previous installation at least I have installed completely twice before once in the office and once in a live environment with my senior as I earlier said.
If you are preparing for being AWS certified. You can refer to these AWS Video Courses for DevOps and Architect level courses.
To be very honest everything was shown to me how to do and it was explained to me by my senior but due to lack of deep exposure to the file system hierarchy, something was not working. I was pretty sure that there is no issue with server installations.
So I was a little bit hesitant to call for help as I had a really good experience with installations. I will let you know why we have brought one server from the same client in our office as two engineers have already visited the branch to make that branch live and failed to install so they courier that server to the office.
When I joined the same server has been given to me for trying to install with some write up how to install.
Believe me, I have installed it in the first attempt in front of the office and it was much appreciated as office strength was around 100 engineers and managers on the same floor so almost all praised me considering the facts experienced engineer visited and failed to do so and they brought the complete server to office.
I was having a very good experience so I was hesitant to report and decided one thing this I have to deal with because I have many branches lined up one by one with a target date.
So I want to make myself well versed in the process as I was dedicated to that client and I was directly reporting to them and the cabin was allocated with the phone to resolve any problem with my company setup.
That was the need of the hour for me. So I decided to stay everything was happily arranged by the client as there were not too many hotel options as it was kind of remote branch of the client.
I was from Govt based company and so was the client. All pieces of software’s either Desktop or Server were shipped with the licensed software.
One media box I have already opened CD-based with System Handbook. I went through the handbook thoroughly maybe 4-5 hours if my memory serves me maybe till 2 PM night.
The next morning I reinstalled both the server again even knowing that installation was not wrong and I set up everything from scratch and created 8 users for 8 departments. Thanks to System Book I was having a little better understanding of user management stuff.
All other setups already set up. I was able to fix the user home directory issue and reinstalled and configured 8 port stallion I/O card for Terminal Connectivity.
Finally, I restored backup related to the branch which has been provided by the branch programmer and all eight terminals were tested and everything tested well.
Finally, I was present during the inauguration of the branch and waited almost half a working day of successful operations before I left the branch alone.
After that, I took the system book for reference purposes which no one has any kind of objection to as it was managed by us only please remember I am referring system book, not media.
After that, I was well versed and I made all most 25 more branches online.
There was another vendor sharing the same client or another client in the region they use to have me with them when they go to make any of their clients online.
I love to hear their expression that he did the same but it was not successful and I did the same in front of them as after all that was their client and they were supposed to and whatever I was doing on behalf of him and get success.
We are still very good friends but due to personnel requirements we might be living in different geography but occasionally we do connect.
So based on experience what I can say linux commands are the real friend for linux administrators. Now it is google era things are quite easy and question like how to become really very easy.
Linux Commands to Find a File in Linux
In Linux World, there are many ways to do the same stuff and get the same expected results.
Mainly in any linux distros, all the normal user linux commands are placed as cooked scripts shipped with OS as part of Distros bundle exists under /usr/bin while all other system-level privilege linux commands which can make a change to server globally under /usr/sbin. The same standard has been followed by any third-party vendor applications.
locate command to find a file in linux
locate command to find a file in linux is really handy for all linux users either standard users or linux administrators. There is a huge number of linux commands and it is not possible to memorize all of them for anyone.
So the importance of locating the linux commands path becomes much more important. You can deal well with errors like “command not found” if you get while running any linux commands.
As the name suggests, it locates the path of files in the Linux System. It works only in linux but normally disappears in Unix systems.
The general syntax of the locate is like below.
$ locate <filename> $ locate vgs /sbin/vgscan /usr/sbin/vgs /usr/sbin/vgscan /usr/sbin/vgsplit /usr/share/man/man8/vgs.8.gz /usr/share/man/man8/vgscan.8.gz /usr/share/man/man8/vgsplit.8.gz
find command to find a file in linux
find command to find a file in linux is a very useful linux command to find a file in linux.
find command in linux has almost the same objective as locate command in linux used to find a file in linux only difference is that this is also widely used in the Unix system as well.
The main advantage of find commands in linux as compared to locate commands in linux is that they are really very useful in file space consumption troubleshooting scenarios.
Most of the Linux users are aware of man pages. If you are still unclear you can refer to 40 basic linux commands for beginners.
So you can get man pages to get the syntax of any linux commands. Syntax of man commands is very easy. Just type man command name.
$ man <locate> $ man <find>
How to use the find command
As mentioned above you can see the syntax of the find command. There are many ways how to find a file in linux.
Search a File in linux by Name
Search a File in linux by Type
Search a File in linux by Size
Few Examples of the find command to find a file in linux areas below just for reference.
$ find /tmp -name core -type f -print | xargs /bin/rm -f
This command will do two functions first it will find files named core in the /tmp directory and then deletes them. This you can use for your housekeeping purpose to have /tmp clean in form of a scheduled task to keep your system healthy.
$ find $HOME -mtime 0
This will find files in your home directory which got modified within 0 days means last twenty-four hours.
$ find / -name abc.txt -print
That`s all about how to find a file in linux using linux commands as of now. I hope you will find it useful. Keep learning linux commands as much as you can to gain expert level.
There is a huge number of linux commands available and too many switches available with each linux command. As you start exploring it and practice it gets set in mind automatically as all commands are considered to be memorable as per their objectives.
Keep learning and exploring more and linux commands to expertise yourself. If you like this post please share as much as you can.