Debian Commands Flashcards
Where can you view a list of user groups
/etc/group
How do you add a user to an admin group
sudo usermod -aG [GROUP] [USER]
-a (append) is critical or will remove from other groups rather than just adding to a new
Find the current date
date
Find the current working directory
pwd
Current computer name
hostname
View directory contents Inc hidden files
ls -a
How do you sort results in reverse
sort -r
How do you output to a text file
(In to home directory for this example)
> ~/output.txt
How to output any potential errors only
(eg of command/script for error logging)
2> [path]
How you output to both screen and file
tee [output path]
Output and add to existing file
> > [path]
Refer to entire contents of current directory
./*
File permissions order
User, Group, Others
How do you find a binary’s location, manual and source
whereis [binary]
How do you find a binary in the PATH variable
which
What is the basic syntax for ‘find’
find [dir] [option] [string]
How do you view the last 10 lines of a text file
tail [path]
How do you view the first 20 lines of a text file.
What is the default number of lines
head -20 <path/file>
Default is 10
How do you number lines in a text file
nl [path]
How do you search for any/all occurrence of a word and replace it
sed s/word/replacement/g
leave out g for just first instance of word, or replace it with the numerical instance of word.
How to request a new IP on WLAN
dhclient [WI-FIDEVICE]
How to append a line of text into a file
echo “STRING”»_space; PATH
How do you check if a software package is available in the Deb repositories
apt search STRING
How to uninstall software Inc config files
sudo apt purge