Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok, having find disabled was not mentioned in your first message. Given your situation, you could use cd, ls, and grep in a shell script; however, it's not going to be efficient. Why did you disable find (probably the best tool for the job) when you apparently need that functionality.
Ok lets first clarify that "I" did not disable find ;O)
I'm simply asking the question because the system I'm being forced to administer - has been bared boned - and almost nothing is on the system - kind of funny actually - but just the same merits a question - what can one use to search? I just want to know the other possibilities...
Well for files, having find, locate and where not installed, you could always install find. That is what I would suggest, as its probably the best suited for the job.
thanks mates - question - if my system was comprimized[and assuming they have a prompt] - would not a locate,grep or find command allow for easier find of files - instead of someone having to "know" exactly how the system is setup? Just thought I'd throw it out there?
Security by obscurity is not a solution. Unless the person who setup the system went out of their way to make major system changes, the majority of the system files are going to be in common locations. While not terribly efficient, an attacker could probably simulate the find command with a for loop, ls, cd, and grep. Removing unnecessary utilities can be done to make a system more secure, there is a point where it will impede on an admin's ability to work on a system.
I never use find.
try:
cd / (cd to root)
ls -Llt somefile* | more
or you could redirect the output to a file to view easier this way:
ls -LLt somefile* >> newfile.txt
the upper case L makes the ls look into sub directories also; lower case l says long listing and t sorts by time. To get a reverse order try adding a lowercase r to the command.
Hope this helps.
Moon
Opps, I posted to fast. You also mentioned grep. grep is a great tool. But it searches for text inside of files, not file names. The ls command I just posted assumed you were looking for a file name somewhere in your file system. If your looking for text inside of a file use grep. for example if I want to find how my ftp is set up, I'd cd to my /etc directory. and then do:
grep ftp * | more
the * says look inside every file in this directory for the text string ftp.
everyfile with the characters ftp inside it would be listed in the output. pretty slick.
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
grep searches what is given to it, if it receives stdin, then it
searches stdin. If it receives a filename, then it searches the
filename.
Code:
cd /
for i in `ls`; do cd $i; echo $i/`ls | grep "reboot"`; cd ..; done
will find any instance of reboot in the first level of the directory
tree. You can easily extend this to find files in the directory tree.
This is stupidly slow, and any cracker can do it without the
find/locate command. If you can do it, a cracker can do it.
Security works by making it difficult for the punk to get on your
system, but once they're on, you had better have made backups.
As has been said, obscurity is not security, it just makes your
job more difficult. Do it right and make sure the system is as safe
from the outside as possible, then make sure you perform
backups.
Opps. My bad. I didn't have my RH 7.2 box close by and relied on my elusive memory.
Uppercase L does show symbolic links.
Uppercase R traverses down through all sub dir's.
I've just tried this so I KNOW it works this time.
try:
ls -lR
then pipe it to more, or redirect it to a file as i mentioned in the earlier post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.