files and processes what where and why
Skip this Video
Download Presentation
Files and processes, what where, and why?

Loading in 2 Seconds...

play fullscreen
1 / 20

Files and processes, what where, and why? - PowerPoint PPT Presentation

  • Uploaded on

Files and processes, what where, and why?. Files are the building blocks. Used for storing stuff (files) Used for pointing to other files (symlinks, directories) Used for representing physical devices (/dev/hda, /dev/lp0, /dev/usb/mouse0)

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' Files and processes, what where, and why?' - leal

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
files are the building blocks
Files are the building blocks
  • Used for storing stuff (files)
  • Used for pointing to other files (symlinks, directories)
  • Used for representing physical devices (/dev/hda, /dev/lp0, /dev/usb/mouse0)
  • Used for representing internal kernel info (/proc/10826, /proc/sys/net/ipv4)
  • Used for processes to interact (sockets, FIFOs, etc)
processes are running programs
Processes are running programs
  • They can be spawned, suspended, resumed, or killed.
  • Ps command lists them.
  • Each process is also represented as a set of files in /proc
we ll learn about files
We\'ll learn about files..
  • Where are they?
  • How do we find out information about them?
  • Why are they useful?
  • What types of files are common?
  • What are some interesting files?
we ll learn about processes
We\'ll learn about processes
  • How do we tell which ones are running?
  • How do we string them together to perform nifty tricks?
  • How do we send them signals, to kill them, suspend them, etc?
  • What tricks can we perform to find out more about what a process is doing?
where the files at dog
Where the files at, dog?
  • Filesystem standards: FSSTD
  • Paths
    • Your path is the place in the tree something fits.
    • Example: /home/ucf/lruppert
  • Navigation
    • Cd command changes where you are.
    • Pwd command tells you where you are.
looking at files
Looking at files
  • Ls -l shows all.
  • Hidden files start with a period. Ls -a includes them in the listing.
  • Ls by itself for quick displays of files.
  • For text files, more \'filename\' works pretty well.
  • You can find files with the locate command.
  • RTFM!
why files
Why files?
  • Treating everything as a file provides one unified way to communicate with everything.
  • It gives us one concept to learn instead of many.
  • It\'s an easy way to find the resources at your disposal, since everything fits in one big tree that represents your world.
what are some kinds of file
What are some kinds of file?
  • \'flat\' files, like /etc/passwd
  • Database hash files like /etc/aliases.db
  • Directories like /etc
  • Device files like /dev/lp0
  • Links and symbolic links, like /etc/rc.d/* or /etc/timezone
  • Kernel data like /proc/cpuinfo
  • Process listings in /proc/
  • Weird stuff like sockets like /tmp/.X0-socket
some cool files to poke at
Some cool files to poke at
  • /etc/passwd – Lists system accounts
  • /proc/cpuinfo – Shows the chip
  • /proc/pci – Shows the devices plugged into a reasonably modern system.
  • /var/log/messages – System errors and various chatty things programs make note of.
processes are running programs1
Processes are running programs
  • The ps command shows what\'s running.
    • Ps -ef shows everything
    • Ps -fp shows one process
    • Parent processes can be seen.
    • RTFM.
  • Listings for each process in /proc/
how do we string them together
How do we string them together?
  • The pipe symbol | is your friend.
  • Redirecting output: < and >
  • Appending stuff: >>
  • Examples:
    • Ps -ef | more
    • Ls -l | grep goat
    • Cat /var/log/messages | grep postfix | grep reject | sort | more
  • RTFM
deciding who lives or dies
Deciding who lives or dies
  • Each process has a process ID
  • Signals have names and numbers:
    • HUP – Hangup signal
    • KILL – Kill with extreme prejudice
    • STOP – Suspends a process
    • CONT – Resumes a suspended process
    • TERM – The default when you issue a kill command.
the kill command is your remote control
The kill command is your remote control
  • kill pid
  • kill -HUP pid
  • kill -9 pid
  • kill -STOP pid
  • kill -CONT pid
  • kill -INT pid
  • killall pattern
  • RTFM
the top command is your friend
The top command is your friend
  • Top lists the top resource pigs on your system at the time. It\'s useful for finding out why your machine is so slow.
processes beget processes
Processes beget processes
  • Init process starts sshd
  • Sshd starts login
  • Login spawns a shell
  • Apache spawns perl, which runs neomail.
  • It\'s another big happy Unix tree.
eavesdropping for the perverse
Eavesdropping for the perverse
  • You can eavesdrop on processes with the strace command, if there\'s no other way to find out why they\'re being evil.
  • strace -p processid
  • strace command line
  • Everything in Unix is trees of files. Understand files, and processes, and you understand Unix.
  • Everything in action is a process. Understand processes and you understand the system in action.
  • Files are physical reality, processes are spiritual.
  • Look at processes on your system. Start processes, stop them, kill them, eavesdrop on them.
  • Look around your filesystem. Examine files, and get a feel for the structure and design of the tree.
  • Look at the kernel files in /proc
  • Learn a couple of the following and run them in strings to have effects on things: cat, sort, uniq, grep, more, tee
  • Read chapters 2, 3, 4, and 9 from rute.