D281 - Linux Foundations

WGU - D281 - Linux Foundations

110 flashcards · Computer Science · by Denny Ferrassoli

  1. Red Hat Based Linux Kernels

    Red Hat Enterprise Linux (RHEL) Fedora CentOS RPM based packages

  2. Debian Based Linux Kernels

    Ubuntu Ubuntu variants: Kubuntu, Zubuntu, Ubuntu Mate (mah-tay) Mint PopOS Any .deb based packages

  3. Non-Debian/RedHat Linux Kernels

    Arch Linux Slackware SUSE Android ChromeOS Raspbian Embedded systems

  4. System Info: Command: Display Linux system information

    uname -a

  5. System Info: Command: Display kernel release information

    uname -r

  6. System Info: Command: Show how long the system has been running + load

    uptime

  7. System Info: Command: Display who is online and what they're doing

    w

  8. System Info: Command: Display current user

    whoami

  9. Hardware Info: Command: Display CPU information

    cat /proc/cpuinfo

  10. Hardware Info: Command: Display memory information

    cat /proc/meminfo

  11. Hardware Info: Command: Display free and used memory

    free or free -h (human readable)

  12. Hardware Info: Command: Display PCI devices

    lspci -tv

  13. Hardware Info: Command: Display USB devices

    lsusb -tv

  14. Hardware Info: Command: Display information about CPU, memory, storage, and network interfaces

    lshw

  15. Perf/Monitoring: Command: Display and manage the top processes

    top

  16. Perf/Monitoring: Command: Interactive process viewer (top alternative)

    htop

  17. Perf/Monitoring: Command: Display processor related statistics

    mpstat 1

  18. Perf/Monitoring: Command: Display virtual memory statistics

    vmstat 1

  19. Perf/Monitoring: Command: Display I/O statistics

    iostat 1

  20. Perf/Monitoring: Command: Capture and display all packets on interface eth0

    tcpdump -i eth0

  21. Perf/Monitoring: Command: Capture and display all packets on interface eth0 PORT 80

    tcpdump -i eth0 'port 80'

  22. Perf/Monitoring: Command: List all open files on the system / for user

    lsof (all) lsof -u <user> (open files for user)

  23. User Info/Management: Command: Display the user and group ids of your current user

    id

  24. User Info/Management: Command: Change current user password

    passwd

  25. User Info/Management: Command: Create a new group

    groupadd <name>

  26. User Info/Management: Command: Create a new account

    useradd -c "comment" -m <username> -c is for a comment -m creates the home directory

  27. User Info/Management: Command: Delete a user account

    userdel <username> userdel -r <username> will remove the user home directory and mail spool

  28. User Info/Management: Command: Add user to a group

    usermod -aG <group> <user>

  29. File/Directory: Command: List all files in a directory

    ls -a ls -al

  30. File/Directory: Command: Show present working directory

    pwd

  31. File/Directory: Command: Create symbolic link

    ln -s /path/to/file <linkname>

  32. Process Management: Command: Display currently running procs

    ps ps -ef (all running procs on system) ps -ef | grep <procname> (search for proc) pa -aux

  33. Process Management: Command: Kill a process

    kill <processid>

  34. Process Management: Command: Kill all processes with name

    killall <processname>

  35. Process Management: Command: Start a program in the background

    <program> &

  36. Process Management: Command: Display stopped or background jobs

    bg

  37. Process Management: Command: Bring background job to foreground

    fg (most recent) fg <n> (bring job n to foreground)

  38. Process Management: Command: Run process even after user logs out

    nohup <processname>

  39. File Permissions: File permission starts with what letter if the file is a directory?

    d example directory: drwxrw-r-- example file: -rwxrw-r--

  40. File Permissions: What are the three groups named in file permissions? Example: What does A,B,C stand for in this permission: -AAABBBCCC

    User Group Other

  41. File Permissions: What are the three types of permissions you can apply to a file for a user, group, or other?

    rwx Read, Write, Execute

  42. File Permissions: Command: Change user ownership of a file

    chown <user> /path/to/file

  43. File Permissions: Command: Change group ownership of a file

    chgrp <group> /path/to/file

  44. File Permissions: Command: Set permissions of a file to allow the following User: read, write, execute Group: read, execute Other: read

    chmod 754 <file> Result = -rwxr-xr-- Also: chmod u+rwx,g+rx-w,o-rwx <file>

  45. Shell: Echo text to a file, replacing the contents

    echo testing > file.txt

  46. Shell: Append text to an existing file

    echo testing123 >> file.txt

  47. Shell: Chain multiple commands with subsequent commands only running if the previous was successful

    command1 && command2 && command3

  48. Shell: Store the current date into a variable

    $datenow=`date`

  49. Shell: Store the current date into a variable and concat the text " WOW!" after the date

    $datenow="`date` WOW!"

  50. Shell: Store the raw environment variable $PWD in another env variable, and make sure when you echo the new env variable $PWD is not expanded. Example: echo $myvar Should output: $PWD It should not show the present working directory!

    myvar='$PWD' Notice single quotes will not expand the variable. Double quotes will expand the variable.

  51. Definition: What is HCL?

    Hardware Compatibility List Tested, compatible, hardware devices for a particular distro

  52. What type of multitasking does Linux use?

    Preemptive multitasking: a task in which a computer operating system uses some criteria to decide how long to allocate to any one task before giving another task a turn to use the operating system. The act of taking control of the operating system from one task and giving it to another task is called preempting.

  53. Name 3 Linux GUI's

    X Window (or X) GNOME KDE Xfce Cinnamon

  54. What year was Unix created?

    1969 At AT&T's Bell Labs

  55. What year was the Linux Kernel created?

    1991 By Linus Torvalds

  56. What makes up a complete linux-based OS?

    Kernel Core Tools (Window system, disk mgr, etc) Supplemental Software (user software) Startup Scripts Installer

  57. Name some package managers used by linux distros

    rpm apt dpkg yum

  58. Define IaaS (infrastructure as a service)

    Provides low-level hardware, no operating system / apps

  59. Define PaaS (platform as a service)

    Provides low-level hardware and operating system

  60. Distro Lifecycle Management: Define STS and LTS

    STS = Short-term-support LTS = Long-term-support

  61. Open Source Licenses: The Linux kernel uses which open source license?

    GPLv2

  62. Open Source Licenses: What is the main difference between GPLv2 and GPLv3?

    GPLv3 contains clauses intended to combat use of hardware restrictions

  63. Shell Commands: How do you share a variable with child shells? Example: thing=1 bash echo $thing 1

    export thing=1 bash echo $thing

  64. Shell Commands: How do you create a tar file?

    tar -c -f <file>.tar <file(s) or folder(s)>

  65. Shell Commands: How do you extract a tar file?

    tar -x -f <file>.tar

  66. Shell commands: Redirect standard err to standard out

    Echo "hello" > file.txt 2>&1

  67. Shell commands: Use tail and sort to skip the first line of a file and sort the contents

    tail -n +2 | sort

  68. Shell commands: Use cut on a csv file to show the second column

    cut -d, -f 2 test.csv

  69. Shell commands: How do you count the number of lines in a file?

    wc -l <file> or: grep “test” <file> | wc -l

  70. Filesystem: What folder stores device info?

    /dev

  71. Filesystem: What folder stores process info?

    /proc

  72. Filesystem: Where are kernel files stored?

    /boot

  73. Filesystem: Where are log files stored?

    /var/log

  74. Filesystem: Where are configuration files stored?

    /etc

  75. Filesystem: Where are system logs stored?

    Ubuntu: /var/log/syslog RedHat/Rocky: /var/log/messages

  76. Filesystem: How can we see systemd logs?

    journalctl -u cron Log files are going binary! journalctl is the future for looking up logs.

  77. Vocabulary: What does POSIX stand for?

    Portable Operating System Interface

  78. Commands: What other command beside man can be used to look up information?

    info Example: info info

  79. Filesystem: Where can documentation about programs potentially be found in the filesystem?

    /usr/doc /usr/share/doc /usr/share/doc/packages

  80. Commands: What command can search a database of filenames that Linux maintains? (typically updated every 24 hours and can be updated by using the updatedb command)

    locate

  81. Commands: How can you recall the last ARGUMENT from the terminal?

    !$ Example: touch file{1..100} rm !$

  82. Commands: How can you search your bash history?

    Ctrl+R then type to search

  83. Commands: What's the new command that replaces netstat?

    ss Example: ss -tuna Similar to: netstat -tuna

  84. Commands: How do you make a named pipe?

    mkfifo <pipename>

  85. Commands: How do you listen to the tail of a file?

    tail -f <file>

  86. Commands: Which command is ran interactively? ps or top

    top

  87. Commands/Logging: How can you view logs for the kernel ring buffer?

    dmesg example: dmesg | less dmesg | grep sda (to search for issues with disks)

  88. Packages: What package management tool does Debian use?

    apt

  89. Packages: What package management tool does Red-Hat use?

    rpm yum

  90. Permissions/Commands: How do you turn on the sticky bit?

    chmod -t <folder> chmod 1777 <folder>

  91. Permissions/Commands: What's another way to view the passwd, hosts, or group "databases" other than using a text editor or cat?

    getent passwd getent group getent hosts

  92. User Info/Management: Command: How do you view default settings that a user gets when a new user is created?

    useradd -D or: /etc/default/useradd

  93. User Info/Management: Command: How do you create a system account?

    sudo useradd -r <name>

  94. User Info/Management: Command: How do you check last password change / expiration?

    sudo chage -l <user> or less verbose: passwd -S <user> passwd -l <user>

  95. User Info/Management: Command: Command to list the last time all users have logged in

    lastlog

  96. User Info/Management: Command: Create a user without a private group

    useradd -m -N <user> tail -n1 /etc/passsword should show that <user> does not have a private group (ie: user:x:1006:100::/home/user)

  97. Group Info/Management: Command: Add a user to a group

    gpasswd -a <user> <group> or usermod -a -G <group> <user> or edit the /etc/group file

  98. Commands/Files: What command do you use to show details of a file? (including size, access rights, ownership, created on, last update)

    stat <file>

  99. Commands/Files: How do I get the read/write/execute permissions of a file in octal format?

    stat -c %a <file>

  100. Commands/Files: How do I get the read/write/execute permissions of a file in symbolic format?

    stat -c %A <file>