linux introduction n.
Skip this Video
Download Presentation
Linux Introduction

Loading in 2 Seconds...

play fullscreen
1 / 11

Linux Introduction - PowerPoint PPT Presentation

  • Uploaded on

Linux Introduction. Part 2. Finding Files. find “ start directory ” -name " filename “ Find the file called "filename" on the filesystem starting the search from the “start directory ” locate filename Find the file name which contains the string "filename". Easier and faster.

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 'Linux Introduction' - rene

Download Now 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
finding files
Finding Files
  • find “start directory” -name "filename“
    • Find the file called "filename" on the filesystem starting the search from the “start directory”
  • locate filename
    • Find the file name which contains the string "filename". Easier and faster.
  • which executable_name
    • Show me the full path to the executable that would run if I just typed its name on the command line.
  • whereis command
    • Print the locations for the binary, source, and manual page files of the command "command".
  • grep -r ‘text_to_find' . |more
    • Search all files in the current directory and all its subdirectories (the option "-r" stands for "recursive") for the example string "text_to_find ". Print the filename and the line in the file that contains the searched string.
installing packages redhat binary package rpm
Installing Packages: RedHat binary package (*.rpm)
  • rpm packages located in the RPMS directory on the installation CD
  • To read the info on uninstalled package
    • rpm -qpi package_name-version.platform.rpm
    • q: query (must be first), p: uninstalled package, i: display info
  • To install the package
    • rpm -ihv package_name-version.platform.rpm
    • i: install (must be first), h: display "hashes" to show the unpacking progress, v: verbose
installing packages redhat binary package rpm1
Installing Packages: RedHat binary package (*.rpm)
  • Finding files of installed package
    • rpm -ql package_name-version.platform.rpm
  • Upgrading package
    • rpm -Uvh my_new_file.rpm
  • Installing and ignoring dependencies
    • rpm -ivh --nodeps package_name-version.platform.rpm
    • rmp -ivh --nodeps --force package_name-version.platform.rpm
  • rpm -e package_name
    • Uninstall (option "e"=erase) the package package_name. No "-version.platform.rpm" at the end of the package name
  • rpm -qf a_file
    • Find the name of the installed package to which the file "a_file" belongs or belonged.
installing packages source code tarball
Installing Packages: Source-code Tarball
  • Linux source code downloaded in the form of a compressed tarball (*.tar.gz or *.tgz)
  • Installation steps are usually as follows:
    • First, change the current working directory to /usr/local :
      • cd /usr/local
    • Second, I decompress the tarball that I downloaded from the net:
      • tar -xvzf /home/the_tarball_dir/my_tarball.tar.gz
      • The contents of the tarball are extracted into a subdirectory which tar creates under my current working directory (/usr/local)
      • If the tarball is not compressed (e.g., *.tar), use:

tar -xvf /home/the_tarball_dir/my_tarball.tar

installing packages source code tarball1
Installing Packages: Source-code Tarball
  • Third, go to the new directory
    • dir
    • cd the_new_program_subdir
  • Fourth, most programs are compiled by executing these three commands:
    • ./configure
    • make
    • make install
  • Fifth, find the new executable which were just compiled. The names of executables display in green when running this command:
    • ls --color
  • Run the executable, for example:
    • ./the_executable
  • Some programs automatically install the executable to /usr/local/bin
    • /usr/local/bin/the_executable
some administration commands
Some administration commands
  • su
    • (=substitute user id) Assume the superuser (=root) identity. Type exit to return.
  • printtool
    • (as root in X-terminal) Configuration tool for your printer(s). Settings go to the file /etc/printcap and /var/spool/lpd.
  • linuxconf
    • (as root, either in text mode or in the X terminal). You can access and change hundreds of network setting from here.
  • kudzu
    • (as root). Automatically determines and configures hardware.
  • lsdev
    • Display info about your hardware (DMA, IRQ, IO ports).
some administration commands1
Some administration commands
  • lsmod
    • (= list modules). List currently loaded kernel modules. A module is like a device driver.
  • modprobe -l |more
    • List all the modules available for your kernel.
  • insmod
    • (as root) Insert modules into the kernel
    • insmod module_name
  • chkconfig --list | more
    • To check the current status of services
  • To start a service
    • service wu-ftpd start
    • OR /etc/init.d/wu-ftpd start
some administration commands2
Some administration commands
  • ps
    • (="print status" or "process status") List the processes currently run by the current user.
  • ps axu | more
    • List all the processes currently running, even those without the controlling terminal, together with the name of the user that owns each process.
  • top
    • Keep listing the currently running processes on my computer, sorted by cpu usage (top processes first). Press <Ctrl>c when done.
      • PID = process identification.
      • USER=name of the user who owns (started?) the process.
      • PRI=priority of the process (the higher the number, the lower the priority, normal 0, highest priority is -20, lowest 20.
      • SIZE=kilobytes of code+data+stack taken by the process in memory.
      • RSS=kilobytes of physical (silicon) memory taken.
      • SHARE=kilobytes of memory shared with other processes.
      • STAT=state of the process: S-sleeping, R-running, T-stopped or traced, D-uniterruptable sleep, Z=zombie.
      • %CPU=share of the CPU usage (since last screen update).
      • %MEM=share of physical memory.
      • TIME=total CPU time used by the process (since it was started).
      • COMMAND=command line used to start the task (careful with passwords, etc., on command line, all permitted to run "top" may see them!
some administration commands3
Some administration commands
  • Display files (cat command) in the /proc directory to display some system info
    • /proc/cpuinfo --information about the processor, such as its type, make, model, and performance.
    • /proc/meminfo --how much memory Linux uses (or use the free command)
    • /proc/devices --list of device drivers configured into the currently running kernel.
    • /proc/dma --DMA channels being used at the moment.
    • /proc/filesystems --filesystem types configured into the kernel.
    • /proc/interrupts --interrupts in use, and how many of each there have been.
    • /proc/ioports --I/O ports in use at the moment.
process control
Process control
  • any_command &
    • Run any command in the background. The job_number is printed on the screen
  • jobs
    • List my background or stopped processes and show their job numbers.
  • batch
    • batch

at>any_command <Ctrl>d

    • Run any command (when the system load is low. The process will keep running after logout. When the command completes, an email will be sent to the user with the output
  • at time
    • Execute a command at a specified time (say 17:00). You will be prompted for the command(s) to run, until you press <Ctrl>d.
    • atq (display the queue of processes started with at)
    • atrm (remove a process from the "at queue").
  • watch -n 60 any_command
    • Execute any_command repeatedly at 60-second intervals
  • kill PID
    • Force a process whose Process ID is PID to shutdown.