LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copying the /proc directory (https://www.linuxquestions.org/questions/linux-newbie-8/copying-the-proc-directory-733241/)

Anfield_84 06-16-2009 12:44 AM

Copying the /proc directory
 
Hey guys, I'm a first time poster so go easy on me =P

What is the most simplest way to copy the proc directory to a flash/portable hard drive? I don't want to go in to too much detail, but i basically want to be able to view these files whenever i want, wherever i am.

Any help would be greatly appreciated =)

sonnik 06-16-2009 01:24 AM

/proc is mostly "special" files, and a copy like you may be thinking of may not be what you want.

For example, in my proc directory right now, the "2756" directory contains information about the Firefox process I'm using to post this message.

Code:

ls -l /proc/2756/fd
Provides information about file sockets currently in use by Firefox.

This information changes from session to session of course.

Unfortunately, you'll need to provide the details on what you're trying to accomplish.

Anfield_84 06-16-2009 01:42 AM

Thanks for your reply sonnik,

Basically i want to be able to save these files and then upload them to a network where everyone can view them. I know they are per session as you already said, but some obviously don't change such as meminfo and cpuinfo.

syg00 06-16-2009 01:46 AM

If you can read it, you can copy (cp) it. With /proc, being a pseudo filesystem, there are a lot of "files" you can't read, a lot it makes no sense to read, and a few you wouldn't really want to.

Pick a sensible subset and copy those.

Edit: seems our posts crossed in flight.

Anfield_84 06-16-2009 01:52 AM

Haha that's ok. I've tried a cp but i keep getting messages saying that some files are being omitted, however i believe those could be for the current running processes. Ill give it another try on particular files individually that I'll require and see how i go from there.

Thank you for your help sonnik!

sonnik 06-16-2009 01:56 AM

sounds like you may be trying to copy as a regular user ... You'll need root privs for this...

Code:

cd /my/path/to/copy/to
cp -r /proc/* .

Please post here if I'm misunderstanding. You can of course send this to a tar.gz if you like as well.

BeacoN 06-16-2009 02:23 AM

copying proc dir
 
I'm guessing you don't want the process info. I'd use the blessed find command. perhaps just grabbing the files will work (processes are in directories)
try...

find /proc -type f -exec cp -iv '{}' */media/put/here* \;

and of course write the dir where to go in *...* above.

Anfield_84 06-16-2009 02:25 AM

Thank you to everyone for their replies, I'll make sure to give these all a try =)


All times are GMT -5. The time now is 01:38 AM.