Find a file
Hi all
I'm newbie in Linux. I want to find some file on whole Linux file system. And I want to export some environment variables every time I connect to session Where I must put this code? Thanks... |
Can't really help with the environment variables, but to find a file, open up a terminal and type:
Code:
find / -iname file_you_want_to_find Hope this helps. |
Hi Ejdaha,
Welcome to the real world. "find" itself is the command man find will tell you more ex #find / -name "test.txt" there are more options in find. as finding by name,regular expressions, size, date, file type etc. man find will help u more. for environment variables, put them in /etc/profile as root. This is the common file for all users. ~/.bash_profile is for particular users. |
Thank you very very much
|
find / -iname '*wordperfect*' 2>/dev/null
substitute your file for wordperfect |
I also like locate:
locate filename |
Quote:
|
hello,
what do you mean [/dev/null] ? yuubouna |
/dev/null is a special file which sounds silly, but turns out to be very useful. If you write into /dev/null, nothing happens at all - the data just falls though a wormhole in space and time, forever to vanish from the universe.
This seems pretty useless, but it turns out a lot of the time, the output of programs you run on the command line splurge out all sorts of useless information which you might want to ignore. You can do this by re-directing the output to /dev/null. For example (the $ denotes commands you enter in the shell, other lines what is output by those commands): Code:
$ echo "This is annoying output" By default both of these print to your terminal window. For example: Code:
$ ls -d /var /etc /notexisting /alsonotexisting Code:
$ ls -d /var /etc /notexisting /alsonotexisting > /dev/null Similarly, we can choose to re-direct the standard error with 2> Code:
$ ls -d /var /etc /notexisting /alsonotexisting 2> /dev/null |
You just need to find the root folder:)
Anna |
thanks a many matthewg42!
how about this one? iconv -f Shift_JIS -t UTF-8 ${basename} > /dev/null/ does this convert encoding from original FileName to the same FileName? Pardon me, for not being related to this thread.. yuubouna(^_-)-☆ |
Quote:
It will convert from the Shift_JIS character encoding to UTF-8 encoding. It will read input from the file whose name is stored in the variable "basename". Since no output file is specified with the -o option, output will be written to standard output, which is then re-directed to /dev/null (i.e. it is discarded). The original file will not be modified. Note that iconv, in common with many of the Unix command line programs, iconv does not respond well to outputting to the file which is also the input file - doing this will just leave you with an empty file. Instead you should re-direct your output to another filename - perhaps using the same name as the original with a .utf8 suffix, as shown below. If you wish, you may then move the new file "over" the original, erasing it. In this example I do not use a variable to store the name of the input file - it is simply called "my_file", and is assumed to contain valid Shift_JIS encoded text: Code:
iconv -f Shift_JIS -t UTF-8 my_file > my_file.utf8 Code:
mv my_file.utf8 my_file To a command-line newcomer, it's a little scary that commands will silently overwrite files without prompting you "are you sure" at every turn. I suppose the rationale is that if you can be bothered to type a command, you should know what you want. This becomes a benefit to productivity once you know what you're doing despite the initial hesitation it sometimes causes. It also means users don't get conditioned into just replying "yes" to every prompt without reading them (enable macros in this word document anyone?). |
All times are GMT -5. The time now is 06:44 PM. |