Debian Commands Flashcards

1
Q

Where can you view a list of user groups

A

/etc/group

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

How do you add a user to an admin group

A

sudo usermod -aG <GROUPNAME> <USER>
-a (append) is critical or will remove from other groups rather than just adding to a new</USER></GROUPNAME>

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

Find the current date

A

date

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

Find the current working directory

A

pwd

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

Current computer name

A

hostname

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

View directory contents Inc hidden files

A

ls -a

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

How do you sort results in reverse

A

sort -r

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

How do you output to a text file

(In to home directory for this example)

A

> ~/output.txt

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

How to output any potential errors only

(eg of command/script for error logging)

A

2> ~/output.txt

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

How you output to both screen and file

A

tee ~/output.txt

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

Output and add to existing file

A

> > ~/output.txt

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

Refer to entire contents of current directory

A

./*

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

File permissions order

A

User, Group, Others

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

How do you find a binary’s location, manual and source

A

whereis

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

How do you find a binary in the PATH variable

A

which

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

What is the basic syntax for ‘find’

A

find DIR OPTIONS STRING

17
Q

How do you view the last 10 lines of a text file

A

tail PATH/FILE

18
Q

How do you view the first 20 lines of a text file.
What is the default number of lines

A

head -20 <path/file>

Default is 10

19
Q

How do you number lines in a text file

A

nl <path/file>

20
Q

How do you search for any/all occurrence of a word and replace it

A

sed s/word/replacement/g
leave out g for just first instance of word, or replace it with the numerical instance of word.

21
Q

How to request a new IP on WLAN

A

dhclient WI-FIDEVICE

22
Q

How to append a line of text into a file

A

echo “STRING”&raquo_space; PATH

23
Q

How do you check if a software package is available in the Deb repositories

A

apt-cache search STRING
or apt list STRING

24
Q

How to uninstall software Inc config files

A

sudo apt purge

25
Q

How do you remove software dependencies that are no longer required

A

sudo apt autoremove STRING

26
Q

How do you install software with Git

A

git clone GITHUB URL

27
Q

What is the change owner command

A

chown

28
Q

Command to change ownership to a group

A

chgrp GROUP FILE

29
Q

How do you change file/dir permissions

A

chmod <1-7><1-7><1-7> <file/dir>

30
Q

View current default permissions mask

A

umask

31
Q

How do you SUID bit

A

Enter a 4 before the regular permissions
Eg chmod 4664 over 664

32
Q

How do you add the SGID bit

A

Enter a 2 before the regular permissions
Eg chmod 2664 over 664

33
Q

How do you find a command for something when you don’t know what it’s called?

A

apropos
I.e apropos password

34
Q

How to scp to a remote server

A

scp FILE USER@REMOTESERV:DIR

35
Q

common cpio options

A

-I designates an archive file to use
-i copy in from an archive
-o copy out and create archive
-t create table of contents list
-v verbose
—no-absolute-filenames