Skip to content

Instantly share code, notes, and snippets.

@OddExtension5
Last active October 23, 2019 08:31
Show Gist options
  • Save OddExtension5/e8e7595963c1200cc24315b65cc16a85 to your computer and use it in GitHub Desktop.
Save OddExtension5/e8e7595963c1200cc24315b65cc16a85 to your computer and use it in GitHub Desktop.
Linux Command

Man pages common elements

  • Command summary: shows how to use a command

    • Items between [brackets] are optional
    • If you see {a|b} youy must choose
    • And ... means you may have more of the preceding item
  • Man pages have sections

    • 1 is for end-user commands
    • 8 is for administrator (root) commands
    • 5 is for configuration files
  • many man pages have examples near the end

  • use /sometest to search for sometext

  • And use q to get out of the man page

    man whoami

    man lvcreate

    g G n

    man -k user

    man -k user | wc

    mam man

    man -k user | grep 8

    man -k user | grep 8 | create

    mandb

Help Systems Overview

  • man is the primary source

  • pinfo shows usage information for some commands

  • command --help provides short usage overview

  • /usr/share/doc contains additional help for some commands

    cd nano-2.3.1/

    ls

    ls -l

    cd /usr/share/doc/nano/fag.html

    cd /usr/share/doc/pam

LAB 1

  1. Find out which version of the kernel you computer is using

    man -k kernel man -k kernel | grep information man uname uname -r <-- Answer

  2. Use man and related resources to find out how to change the hostname of your computer

    man hostname man -k hostname man hostnamectl hostnamectl --help

    set-hostname NAME <-- Answer

  3. Read the help output for lvcreate and find which options must be used

    lvcreate --help

  1. whoami (who you are?)

  2. hostname (current name of the host)

  3. date (show date, time & year)

  4. uname (kernel information)

  5. passwd (setting password)

  6. touch ( create empty file )

  7. last ( last login in the system)

    whoami -- help

    whoami --help | less

    hostname --all-ip-addresses

    passwd root

    su -

    passwd user

    exit ( out of the root shell)

    touch hello

    ls

    cd ( to home directory )

    sudo -i ( for root account in Ubuntu )

  8. man

  9. man -k is same as apropos

    • The database searched by apropos is updated by the mandb program
  10. pinfo ( text based documentation)

    pinfo coreutils 'whoami invocation'

    n - next

    p - previous

    u - up

    q - quit

    pinfo -a whoami

  11. whoami, hostname, date, uname, passwd, touch, last, man, apropos, mandb, pinfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment