LINUX COMMANDS Flashcards
(30 cards)
LS
lists files and folders in a directory
GREP
SEARCHES TEXT FILES OR COMMAND OUTPUT
EX: Use grep on “access.log” to find the flag that has a prefix of “THM”. What is the flag?
tryhackme@linux1:~$ grep “THM” access.log
13.127.130.212 - - [04/May/2021:08:35:26 +0000] “GET THM{ACCESS} lang=en HTTP/
1.1” 404 360 “-“ “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36”
CD
cd command in linux known as change directory command. It is used to change current working directory.
SHUTDOWN
BRINGS DOWN SYSTEM
PWD
This stands for Print Working Directory
DISPLAYS FULL PATH OR WORKING DIRECTORY
EX: /HOME/MARK
PASSWD
UPDATES CURRENT USER’S PASSWORD
MV
MOVES OR RENAMES FILES
CP
COPY FILES
RM
PERMANENTLY DELETES FILES
You can simply remove files by using rm. However, you need to provide the -R switch alongside the name of the directory you wish to remove.
ex:
tryhackme@linux2:~$ rm note
tryhackme@linux2:~$ ls
folder1 mydirectory
using -R switch:
tryhackme@linux2:~$ rm -R mydirectory
tryhackme@linux2:~$ ls
folder1
CHMOD
CHANGES PERMISSIONS FOR SPECIFIED FILES
CHOWN
CHANGES OWNERSHIP
IWCONFIG
DISPLAYS AND CONFIGURES WIRELESS NETWORK SETTINGS
IFCONFIG
DISPLAYS AND CONFIGURES NETWORK SETTINGS
PS
LISTS PROCESSES
SU
SWITCHES USER TO SPECIFIED USER ACCOUNT
SUDO
RUNS COMMANDS USING ROOT USER ACCESS
APT-GET
UPDATES AND MAINTAINS LIST OF SOFTWARE PACKAGES
VI
STANDARD LINUX TEXT EDITOR
DD
CREATES AN EXACT(BIT-BY-BIT) COPY OF A STORAGE VOLUME
KILL
STOPS A SPECIFIED PROCESS
echo
Output any text that we provide
ex:
tryhackme@linux1:~$ echo “hello Friend!”
hello Friend!
whoami
Find out what user we’re currently logged in as!
ex:
tryhackme@linux1:~$ whoami
tryhackme
cat (concatenate)
Outputting the Contents of a File
“Cat” is short for concatenating & is a fantastic way us to output the contents of files (not just text files!)
ex:
tryhackme@linux1:~/Documents$ ls
todo.txt
tryhackme@linux1:~/Documents$ cat todo.txt
Here’s something important for me to do later!
touch
The touch command takes exactly one argument – the name we want to give the file we create. For example, we can create the file “note” by using touch note. It’s worth noting that touch simply creates a blank file. You would need to use commands like echo or text editors such as nano to add content to the blank file.
ex:
tryhackme@linux2:~$ touch note
tryhackme@linux2:~$ ls
folder1 note