Operating System - HP-UX
1819803 Members
3169 Online
109607 Solutions
New Discussion юеВ

Regarding "/usr/bin/cat" command.

 
Jasmin Berube
Advisor

Regarding "/usr/bin/cat" command.

I was wondering if using cat on critical file like /etc/hosts or /etc/passwd can corrupt the files sometimes or it's safe?
Any bad experience to share? I would like to know.
Thanks!
5 REPLIES 5
Brian M. Fisher
Honored Contributor

Re: Regarding "/usr/bin/cat" command.

The cat command should be safe on /etc/password & /etc/host files I commonly do this without any problems.

Brian
<*(((>< er
Perception IS Reality
Joel Shank
Valued Contributor

Re: Regarding "/usr/bin/cat" command.

The cat command only reads files, it doesn't write to it, so you are safe.
Joel Shank
Valued Contributor

Re: Regarding "/usr/bin/cat" command.

The cat command only reads files, it doesn't write to it, so you are safe.
Dale McNamara
Frequent Advisor

Re: Regarding "/usr/bin/cat" command.

Depending on the types of files you are trying to look at;
the cat command will only output the file, if you wanted to look at just the text in any file, regardless of the type, the strings command will ignore all of the extraneous ascii characters. This will also prevent your terminal from getting messed up by the output.
you will have to pipe this to either pg or more
Carlos Fernandez Riera
Honored Contributor

Re: Regarding "/usr/bin/cat" command.


Both files must be NO write permsions( 644 and 444 ), for any group and other just read.

So even a ' cat /etc/hosts > /etc/passwd' must be rejected if user is not superuser (root).

unsupported