Quicktip:
/proc has subdirectory for each running process as well as some subdirectories for various aspects of your hardware. You can learn lots of details about your cpu, your memory, processes running on your computer, and more by digging around in /proc.
A few things you’ll find in /proc:
- /proc/cpuinfo: Info about your cpu
- /proc/meminfo: Info about your RAM
- In /proc/<pid>/:
- cmdline – the command line used to start the process
- cwd – a link to the current working directory of the process
- environ – the environment variable for the process separated by nulls. Try “cat /proc/<pid>/environ | xargs -n 1 -o”
- fd – directory containing links to file descriptors opened by the process, including files that have been deleted since the fd was created!
What it’s good for:
- Recover a deleted file if some process is still writing to it (tail -n 999999999 -f /proc/<pid>/fd/<file handle> > ~/recovered-file; kill <pid>)
- Check if your cpu is 32 or 64 bit
- Look into the environment variables your process was started with.
- See what directory a process is running in.
- Quickly see the full command like of a process.
- Much more – look around!
From The SDE Tip – Amazon
Popularity: 1% [?]