General :: Find File By Content On System?
Sep 21, 2011How to find file by content on linux by command. Example: i want find file contain word "helo" on my computer (OS: LINUX)
View 4 RepliesHow to find file by content on linux by command. Example: i want find file contain word "helo" on my computer (OS: LINUX)
View 4 RepliesI have the following command that I run on cygwin:
find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | xargs du --max-depth=0 > foldersizesreport.csv
I intended to do the following with this command: for each folder under /d/tmp/ that was modified in last 150 days, check its total size including files within it and report it to file foldersizesreport.csv however that is now not good enough for me, as it turns out inside each
/d/tmp/subfolder1/somefile.properties
/d/tmp/subfolder2/somefile.properties
/d/tmp/subfolder3/somefile.properties
/d/tmp/subfolder4/somefile.properties
so as you see inside each subfolderX there is a file named somefile.properties inside it there is a property SOMEPROPKEY=3808612800100 (among other properties) this is the time in millisecond, i need to change the command so that instead of -mtime -150 it will include in the whole calculation only subfolderX that has a file inside them somefile.properties where the SOMEPROPKEY=3808612800100 is the time in millisecond in future, if the value SOMEPROPKEY=23948948 is in past then dont at all include the folderin the foldersizesreport.csv because its not relevant to me.so the result report should be looking like:
/d/tmp/,subfolder1,<itssizein KB>
/d/tmp/,subfolder2,<itssizein KB>
and if subfolder3 had a SOMEPROPKEY=34243234 (time in ms in past) then it would not be in that csv file.so basically I'm looking for:
find /cygdrive/d/tmp/* -maxdepth 0 -mtime -150 -type d | <only subfolders that have in them property in file SOMEPROPKEY=28374874827 - time in ms in future and not in past | xargs du --max-depth=0 > foldersizesreport.csv
I am using find to search for .tgz files modified more than 7 days ago and delete them.find /directory/ -iname backup*.tgz -daystart -mtime +7 -exec rm -rf {} My problem is that find will go through the content of tarball as well and list all content. I want to only search main tarball and delete it if older than 7 days.
View 4 Replies View RelatedIf you have the value 100 in File1 and the value 5 in File2, how do you write a script to divide the 100 in File1 by the 5 in File2 in Linux Bash Shell?The operating system I am using is Ubuntu 10 and object is to write a script to accomplish this task.
View 5 Replies View RelatedI have to move all the files and directories between 2 file systems. Is it good practice to move them at once or first copy them and then move ? How to do this to preserve the permissions and directory structure ?
View 3 Replies View Relatedhow to find the latest modified directory. I know that the command 'ls -rtl' gives the latest modified file/directory at the end. But my specific requirement is: If I create two directories named dir1, dir2 in the same order. so now my latest modified directory is "dir2". Now inside each directories, I created a file. Now in the last, I modify the file in "dir1". So overall, the content of dir1 got modified recently. If I use the command 'ls -rtl', this will still show dir2 as latest, as it is created recently. But I want the directory in which any internal content at any sub-hierarchy modified recently. so with what linux command I'll get this latest modified directory (dir1)?
View 3 Replies View RelatedHow to find continuously growing files in the file system?
View 11 Replies View RelatedWe have recently built some RAC (OS:RHEL55) servers and after the Oracle guys have installed their application, somehow the directory / is using the maximum space. I contacted the Oracle team & they say that their RAC installation doesn't create any files in the / directory. This is the o/p of '/' directory file system:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/datavg-vol2 498M 382M 62M 88% /
Also, when I checked the file sizes, I found that the following files were taking more space:
/etc/selinux/targeted/modules/active/
-rw------ 1 root root 17M Nov1 base.linked
[code].....
I don't know what these files are doing there, when I did a cat and cheked, I found the files containing this data:
nf_tre--
stem_dbusd_var_run_t...and some stuff like this Unable to decide whether or not to remove these files. Also, is there any way to find out what files are taking more space and whether they can be deleted or not? in order to free up some space in the / direcoty. As there are 10 RACs that we've build, I got to do something to fix this for all of the 10 servers.
Found the below from RedHat Knowledgebase
The Completely Fair Queuing (cfq) scheduler in Red Hat Enterprise Linux 5appears to have worse I/O read performance than in version 4. It appears as though the Completely Fair Queuing I/O scheduler (cfq) has a regression and thus exhibits reduced read-side throughput which can affect performance for both local and NFS mounted file systems.
One way to mitigate this is to set the cfq's slice_idle parameter to zero. To change this value, execute the following command echo 0 > slice_idle in the /sys/block directory appropriate for your situation, as shown below:
echo 0 > /sys/block/hda/queue/iosched/slice_idle
We are using NFS file systems in RHEL 5.3. I would like to know how to find which /dev/Device is being used by the NFS file systems, so that I could try setting the slice_idle to '0' to see if there is any difference in performance? In /etc/fstab I only see the actual NAS volumes for the NFS file systems.
I'm using rhel6. Using File Browser Nautilus 2.28.4 I could easily locate any file I'm interested in by it name. I'd like to use this File Browser to locate the file name based on it content e.g. based on some word in the text file. It doesn't work for me that way ... My question: does Nautilus support the search of file based on it content or only based on the name of the file itself?
View 4 Replies View RelatedIs there some file in Linux that enumerates and describes mount options for file systems like /etc/services describes ports?
View 2 Replies View RelatedI need commands which five me the following details abt all the file systems mounted the linux box
type
mount pt
file system id
I'm new to this and I'm sure I've just gone and done something silly. I used pendrivelinux.com's live usb creator to install ubantu 11.04 on my USB. I tried booting my laptop with this, and i get an error message saying "unable to find a medium containing live file system" and I cant get any further than that. The laptop I am using is a Dell XPS with an i7 processor and 6 gigs of memory.
View 6 Replies View RelatedHow do I (through command line) download folder X and all of its content from the remote system to my local system?
View 7 Replies View RelatedI had been trying to install Ubuntu 9.10 after formatting my machine. When i select install of the welcome screen, the logo blinks for few minutes and then displays a error as
Code:
Unable to find medium with live File System
Then goes to busy box.
"The same thing appears with Ubuntu 8.10, which i was using before!"
i have a file and i want to change the content of file but i also want that md5sum of that file remains same.
View 14 Replies View RelatedHow would i write a script which will add a following content to a file.File Before running script.
Code:
acpi = 1
apic = 1
builder = 'hvm'[code]....
I have a file called foo with a date string in it - and nothing else in the file
2010.01.13-22:28:28
I want to send this file content to date -s command so I can modify using a cron job.
I tried several ways to pipe the file contents to date command but did not work.
I have a file clipboard.txt
I do :
Code:
sleep 10s ; echo "focus on the gedit" ; xclip -o clipboard.txt
is not working.
How to make that possible, how?
I am calling a URL from shell script and passing few argumants,Here i have to pass file content as one argument.How can i pass file content through URL.
eg:
content=`cat /Users/test1.txt`
open http://localhost:8080?filecontent=$content
[code],...
I was having a discussion with someone who asked me whether a Linux OS has to be rebooted when the hosts file is modified. From personal experience, on Windows I change the file but don't reboot and I've seen others do the same thing. I assume Linux has no exception(s), but is there any reason why a reboot is not required (to at least justify my actions)?
View 2 Replies View Relatedwhile organizing my HD (windows) i ran across a file that i couldnt open. i check the file type, and the only thing it said was 'file'..so i made it an image and mounted it on my linux VM (cant seem to find, or mount the host OS HD) ..but i dont know the command to find out what's the file system type so i can read whats in it (i'm thinking its a registry bac-up from windows? but it's like 4g's..the modification date is from 2008..so i'm curious to find out what i saved)
View 1 Replies View RelatedI deleted the snmptrapd.conf from /etc/snmp/ and now I want to see the default content to create that file.. Been searching the web but can't find it.
View 2 Replies View Relatedwell i was messing with the Gparted live disk and i deleted a small partition of about 6 megs (yes megs). trying to be efficient doing some cleanup of course. but when i rebooted my Fedora 10 i get the black screen saying," could not find the file system. /dev/root". ok, i am useing the fedora 10 live cd now. can i copy that file to my hard drive from the cd? or do i need to reinstall Fedora?
View 1 Replies View RelatedI have a file, say abc.txt, whit some text lines.The I have a second file, say 123.txt where at a certain point one can read "WORD".I would like to append the whole content of abc.txt (as it appears in abc.txt) in the line after "WORD".
View 1 Replies View RelatedMy employer issues pdf files with everyones work schedules. I copy the content and save it as plain text in a file called unformatted (hope to be able to automate this step someday). Im working on a SED script that reduces unformatted to only display what I want to see and saves the result in a file Iïve named formatted. After that I have to manually copy formatted and save it with that days date as a filename e.g. 2011-02-25 or whatever day is scheduled in the pdf, for use on a mobile device (Nokia N900). I noticed that the date occurs on certain lines in the file so I added a line like:
sed -n 's/^Date: (201[1-9])/([0-1][0-9])/([0-3][0-9]).*/1-2-3/p' < unformatted >theDate
That creates a file theDate with the date in it that I wish to use as the filename for this particular instance. So I would like to skip the file formatted all together and have the sed- script write to a new file using the content of the Date as a filename, but how do I make that happen? And of course it would be more elegant if I could skip the intermediate theDate file as well.
I am trying to get a touchscreen driver installed and I am talking to the techs at the company and they asked for a copy of my xorg.conf file. I have done several searches on my computer and looked on other forums posts as to where that file should be located and I cannot find this file anywhere on the system. Does Ubuntu 10.4 even have a xorg.conf file?
View 2 Replies View RelatedWhen I run 'parted' and then type 'print' to see the partitions that are available, I see two entries: /dev/sda1 and /dev/sda2. /dev/sda1 is of ext3 type whereas for /dev/sda2 nothing is specified for file system type. The LVM flags are set for /dev/sda2.
When I tried to resize /dev/sda2, it gives me the error "File system type not recognized". let me know how to find out the file system type of the partition.
I wanted to copy one file to multiple new files. I have an idea to write a script and do the operation. But here i m looking for any particular command to do this operation.
View 1 Replies View Relatedam new to linux and trying to find a file in sub directories using find command as:find .-name *.jpg -type fBut I am unable to get the result as find command is not permitted by the server administrator.Is there any way to find files without using find command.
View 14 Replies View Related