Linux Commands and General Knowledge

299 flashcards · Mathematics · by Case Deckard

  1. rsync argument to copy files which are symbolic links as such

    rsync -l

  2. rsync argument to retain group permissions for files

    rsync -g

  3. cat argument to omit empty lines

    cat -l

  4. cat argument to view line numbers

    cat -n

  5. cat argument to show $ character at the end of lines

    cat -E

  6. cat argument to show all non-printing characters

    cat -vET

  7. cat argument to show tabs as ^I

    cat -T

  8. Command to querie the DNS server to determine the IP addresses assigned to the hostname

    host [www.google.com]

  9. argument for rsync to run in archive mode ( preserves time stamps, performs a recursive copy, keeps all file and directory permissions, preserves owner and group information, and copies any symbolic links. )

    rsync -a

  10. command to see one liner descriptions of Linux commands

    whatis [command name]

  11. Command to view detailed records for a hostname or network address

    dig [ip addr or hostname]

  12. cp option to ask before overwrtiting preexisting files with the same name

    cp -f (force)

  13. cp option to give detailed output

    cp -v (verbose)

  14. cp option to only overwrite preexisting destination files with the same name if the source files are newer.

    cp -u (update)

  15. cp option to perform recursive copy and keep all original attributes such as permissions, ownership and timestamps

    cp -a (all)

  16. cp argument to copy arguments recursively

    cp -r (or R)

  17. cp option to run in interactive mode and ask before overwriting files

    cp -i

  18. execute a gawk program in sandbox mode

    gawk -s

  19. Use a gawk program file as source code

    gawk -f

  20. Change the default field separator in gawk

    gawk -F

  21. How do you use iwlist to find all the in range wireless networks with a device named wlp2s0?

    sudo iwlist wlp2s0 scan

  22. Program to show/manipulate the IP routing table

    route

  23. How would you use ifconfig to bring down the driver for a device named wlp2s0?

    ifconfig down wlp2s0

  24. ls flag to list contents in reverse order

    ls -r (reverse)

  25. ls option to classify each type of file using an indicator code

    ls -F

  26. ls option to display a dir's metadata instead of it's contents

    ls -d

  27. ls option to list directories recursively

    ls -R

  28. mkdir option to create parent directories if needed

    mkdir -p

  29. mkdir option to set SELinux security context for each created dir to the defualt type

    mkdir -Z

  30. mv argument to ensure that no files are overwritten

    mv -n (no clobber)

  31. mv argument to only overwrite pre existing files if the files being moved into the new directory are newer

    mv -u (update)

  32. nmap command to scan your host computer and see which ports are open from 1-1000

    nmap localhost -p 1-1000

  33. redirection operator to send STDERR to a file

    2> or 2>> to append

  34. How to redirect STDERR and STDOUT to a file?

    &> or &>> to append

  35. rm option for deleting empty directories

    rm -d

  36. rm option to run in interactive mode when deleting more than three files

    rm -I (capital i)

  37. rsyc option to specify the connection type

    rsync -e

  38. rsync argument to retain a file's permissions

    rsync -p

  39. rsync option to retain a files modification time

    rsync -t

  40. Check if the file is already sorted. Produces no output if the file is sorted.

    sort -c

  41. Consider lowercase characters as uppercase characters when sorting.

    sort -f (fold)

  42. Sort according to month. Months must be abbreivated as standard such as Jan, Feb etc

    sort -M (months)

  43. Sort data using the data in column n, what flag to use a different field (space is the default)

    sort -k n -t ':'

  44. sort option to send output to a file

    sort -o (output)

  45. sort text using numerical order

    sort -n

  46. sort the contents of a file in reverse order

    sort -r

  47. systemctl command to allow the service to start automatically at system boot time

    systemctl enable [service name]

  48. tar argument to create a new archive

    tar -c

  49. tar option to list the contents of an archive.

    tar -t

  50. wc option to display in bytes the longest line

    wc -L

  51. wc option to display the character count

    wc -m

  52. wc option to display the total word count

    wc -w

  53. wc option to display the total new line count

    wc -l

  54. wc option to display the file's byte count

    wc -c

  55. What does ifconfig stand for? What is it's job?

    interface config. Configure a network interface

  56. What does the ip commnd do?

    show / manipulate routing, network devices, interfaces and tunnels

  57. What is the command used for configuring wireless network interfaces?

    iwconfig

  58. what is the symbol to redirect standard input?

    <

  59. Where is the directory that containts all the files for various time zones?

    /usr/share/zoneinfo

  60. systemctl command to list all the units in failed state

    systemctl --failed

  61. command to view which unit files need to start before the ssh.service unit file starts.

    systemctl list-dependencies --before ssh.service

  62. what is the command to test how long a command (program) took to execute

    time [command name]

  63. in the time command output what do the 'real', 'user' and 'sys' fields refer to?

    real: how much actual time the program took to run user: the amount of user CPU time the program used sys: the amount of system CPU time the program used

  64. ASCII character set uses how many bits to store characters?

    7 bits (byte is 8 bits)

  65. UFT-8 and UTF-16 use how many bits and bytes

    8, 16 (easy) and 1 and 2 (8 bits per byte)

  66. How many bytes does Unicode use?

    3 (or 24 bits)

  67. What two environmental variables control all localization settings?

    LANG and LC_ALL

  68. Which command can you use to change the value of a localization env variable?

    localectl

  69. what is the difference between locale and localectl?

    locale just lists localization settings, with localectl you can change these and view much more data on localization.

  70. where is the UID (user id) stored?

    All the which environment variable which environment variable user id's are stored in the third field of the /etc/passwd file.

  71. where is the file that controls the process of the useradd command?

    /etc/default/useradd

  72. what is the /etc/skel directory for?

    The skel directory holds files that are to be copied into a users home directory when the account is created.

  73. What is the first field in the /etc/shadow directory?

    the username

  74. What is the second field in the /etc/shadow directory?

    The password field.

  75. In the password field of the /etc/shadow file what does a '*' or '!' indicate?

    That the account cannot log on.

  76. What does an '!' mean when it is in front of the password field of the /etc/shadow file?

    that the account has been locked.

  77. What is the 4th field of the /etc/shadow file?

    the number of days after a password is changed until the password may be changed again.

  78. What is the 5th field of the /etc/shadow file?

    the number of days until a password change is required.

  79. What is the 6th field of the /etc/shadow file?

    the number of days until the user will be warned to change their password.

  80. what is the 7th field of the /etc/shadow file?

    the number of days after a password has expired and has not been changed until the account will be deactivated.

  81. What is the 8th field of the /etc/shadow file?

    date of the accounts expiration in Unix Epoch Time (in days).

  82. What is the 9th field of the /etc/shadow file?

    the 'special flag'. This field is reserved for future use and is currently unused.

  83. What is the flag with the useradd command to see default creation settings?

    useradd -D

  84. what is the useradd argument give a comment which is usually the user's full name.

    usermod -c [name]

  85. what is the useradd argument to set the expiration date?

    usermod -e [yyyy-mm-dd]

  86. What is the useradd argument to change the number of days after a password has expired and has not been changed until the user's account will be deactivated. What is the argument to never let the account be deactivated.

    useradd -f [-1]

  87. what is the useradd flag to set the user's group id (GUID)?

    useradd -g

  88. what is the useradd flag to manually set their UID?

    useradd -u

  89. what is the useradd flag to create a system account instead of a user account?

    useradd -r

  90. how can you see all the groups on the system?

    getent group

  91. use getent to see who is a member of the group called adm

    getent group adm

  92. use getent to see what groups a user named 'sally' is a member of.

    getent group sally

  93. what is the command to force a user to change their password?

    passwd -e [user name]

  94. what is the passwd option to set the number of days after a password has expired and not changed until the account will be deactivated?

    sudo passwd -i (i for inactive)

  95. what is the passwd option to lock a user's account nd stop them from logging on?

    sudo passwd -l [username] (lowercase L for 'lock')

  96. what is the passwd option to set the number of days a warning is issued to a user prior to their password expiring.

    passwd -w [username]

  97. what is the passwd option to unlock a user's account and allow them to log back in?

    passwd -u [username] (u for unlock)

  98. Usermod argument to modify the account's username to the specified new name. Does not modify the home directory.

    usermod -l (llowercase 'L' for logiin)

  99. usermod argument to lock the account, places an exclamation point in front of the password of the /etc/shadow file.

    usermod -L (L for lock)