Common Shell Commands Flashcards

(66 cards)

1
Q

lsmod

A

Shows the kernel modules loaded, can use to verify the driver is loaded for a peripheral

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

lspcu

A

Provides details about the CPU such as the number and speed of each socket and core

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

lspci

A

Shows detailed information about the pci bus and devices, can identify devices on the bus that the kernel doesn’t know about and provides address information.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

/proc

A

Kernal and process information, virtual file system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

lsdev

A

Shows the devices recognized by the system.

Most definitive set of information in one stream of output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

lsraid

A

Displays the redundant array of inexpensive disks (RAID)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

lsusb

A

Displays the USB information and devices for your system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

lsblk

A

Displays the block devices (disks)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

modprobe

A

Loads a module into the kernal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

lssci

A

Shows information about the SCSI devices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

procfs

A

The most popular way to expose kernal Information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

udev

A

Linux kernal device manager

Manages the device files under /dev using information about the device from sysfs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

systemctl

A

Part of systemd

State inspection and state controlling utility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

journald

A

Logging system for systemd, uses binary files for logging

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

networkd

A

The daemon The provides networking support for systemd’s network access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

shutdown

A

shutdown -H
- -halt halts the machine, no shutdown

shutdown -P
- - Poweroff halts and powers off the machine

shutdown -r
- -reboot reboots after proper shutdown

shutdown -k
Only writes a wall message.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

kill

A

Kills process (PID)

Ex. kill smb

ps | grow smb (returns process ID of 388)

kill 388 or kill-9 388 (absolute kill)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

dmesg

A

Shows the output of the last system boot

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

ldd

A

Queries a program and shows its dependent libraries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

dpkg

A

Package management tool

    • info shows package details
    • status check the status of packages
  • s search package database
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

apt-get

A

Responsible for most remote software installation operations.

apt-get install x (installs package x)

apt-get install update (update the cache)

apt-get dist-upgrade (upgrade all packages)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

apt-cache

A

apt-cache search x (searches for packages x)

apt-cache show x (shows info about package x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

pwd

A

Print current working directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

env

A

Show environmental variables

Ex. echo $pwd (print to screen the value of the variable pwd)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
history
Shows the stack of previously executed commands
26
ls
Multi-column output of the current directory. ls -l (long listing, shows all details) ls -a (show all files including hidden) ls -d foo (show only the directory foo) ls -i (list the indie value of the target file) ls -lh (shows a human readable output of file sizes)
27
stat
Shows single file object details
28
file
Search function, reads files headers and matches against known types ex. file file1 (finds file1) ex. file[123] (finds file1 file2 and file3)
29
glob or *
Used as a wildcard replacement. Wildcard operator that matches based on a pattern. ex. file * (return anything)
30
touch
1) touch creates a new blank file Or 2) updates all three file times Access Change Modify Ex. touch foo.txt (creates a new blank text file named foo)
31
do
Copy file cp -p (preserves the original permissions and ownership) cp -d (doesn’t follow symbolic links) cp -f (force overwriting of existing files) cp -i (ask before overwrite) cp -r (transverse directories cp -r dir1) cp -u (only update a copy when the source is newer)
32
mv
Move a file, overwrites the destination file if it already exists mv -i (checks the destination first for duplicates) mv -u (preserves the latest copy of the object)
33
dd
Duplicates drives or allows for partitioning of drives *there are no option values Ex. dd if=/dev/sdc of=/dev/sdc WHERE if = input file of = output file
34
mkdir
Create a new directory mkdir -p (creates directories that do not exist)
35
rm
Remove an object
36
rmdir
Remove directory
37
locate
Used to find a file or set of files Database driven and secure Only files the current user has access to are shown only update daily, not real-time locate -i (ignore file case)
38
find
Most accurate way to find an object but time consuming. Crawls the list of files in real-time vs an indexed database (locate)
39
which
Used to determine the full path of commands that are queried from the PATH variable
40
whereis
Used to find a file by name Ex. whereis ls
41
uname
Shows the operating system uname -a Shows more information including kernal information
42
type
Shows the type of command
43
!!
Executed the last command entered
44
cat
Displays a files contents cat first.txt (displays the files contents on the screen) cat file1.txt file2.txt> combined.txt > (is a redirect)
45
join
Combines two files by matching the contents of specified fields within the files
46
sort
Sort a files output sort list.csv sort -n (treat numbers a whole)
47
head
Shows the first 10 lines of a files contents head -n(x) (specifies the number of x lines) head -c(x) (specifies the number of x byes)
48
tail
Displays the last 10 lines of a file. tail -n(x) (specifies the number of x lines) tail -c(x) (specifies the number of x byes)
49
less
allows you to page through a file [SPACE] page through the file [ESC] [v] moves backwards one screen
50
ps
used to display process information ps -a (displays all processes of the current user) ps -u (shows user information for processes) ps -aux (linux version) ps -ef (version Unix)
51
pstree
hierarchical nature of the processes on the system
52
free
Determines the amount of free memory on the system free -h (option to get the summary information in kB/mb/gb etc
53
top
Shows a running screen refresh of the systems process
54
screen
Text based window or session manager that runs multiple sessions independently [CNTL] a creates a new session window Press x to lock the screen
55
nl
Adds numbered lines to a file
56
tr
Used for changing characters in files or streams, but not whole words or phrases
57
sed
Stream editor, sed is useful at searching and replacing text including words or complete phrases.
58
grep
Text processing command to find almost any string or phrase in a single file grep -c (shows only a numerical count of the matches found) grep -i (matches and ignores case) grep -v shows all lines that don’t match the string
59
uptime
shows amount of time since reboot and also shows the number of users currently on the system, and average number of jobs in the run queue.
60
fdisk
Used to create or alter the partition table
61
debugfs
Shows the details of disk allocation
62
du
To see the space used by a set of files or a file tree
63
df
Displays used and available disk space for all mounted file systems. df -h (human readable output)
64
chown
Used to set the user owner m, group owner, or a combination of the two with one command.
65
chgrp
Used to change just the group owner
66
ip
Show and manipulate routing, devices, policy routing and tunnels