Skip to content

Site Currently Being Updated. Shop opens soon. ๐Ÿ˜ Dismiss

stoketech.club

stoketech.club

Geek Friendly Learning Zone

  • [Discord]Expand
    • [Text2Image]
  • [Courses]
  • [Cheat Sheets]Expand
    • Cheat Sheet: Linux
    • Cheat Sheet: Python: File Handling
  • [RSS]
Log In
stoketech.club
stoketech.club
Geek Friendly Learning Zone

Cheat Sheet: Linux

Basic Commands

CommandDescriptionExample
pwdPrint working directorypwd
cdChange directorycd /home/user/documents
lsList directory contentsls -l
mkdirMake directorymkdir my_folder
touchCreate new filetouch my_file.txt
cpCopy filecp my_file.txt my_file_copy.txt
mvMove or rename filemv my_file.txt my_folder/my_file.txt
rmRemove filerm my_file.txt

User Management Commands

CommandDescriptionExample
whoamiPrint current userwhoami
idPrint user and group IDsid
adduserAdd new useradduser newuser
usermodModify userusermod -aG sudo newuser
deluserDelete userdeluser newuser
passwdChange passwordpasswd

File Permissions

CommandDescriptionExample
chmodChange file permissionschmod 755 my_file.txt
chownChange file ownerchown newuser my_file.txt
chgrpChange file groupchgrp users my_file.txt

Input/Output Redirection

CommandDescriptionExample
>Redirect output to filels > files.txt
>>Append output to filels >> files.txt
<Redirect input from filesort < files.txt
|Pipe output to another commandls | grep txt | sort -r List all files in current directory, search files with “txt” in their name, and then sort the results in reverse alphabetical order.

Advanced Commands

CommandDescriptionExamples
awka programming language used for text manipulation and data extractionawk '/search pattern/ { action }' input_file: searches the input file for the specified search pattern and performs the specified action
seda stream editor used for text manipulationsed 's/search pattern/replacement text/' input_file > output_file: searches the input file for the specified search pattern and replaces it with the specified replacement text, then saves the result to the output file
grepa search tool used to find specific patterns in textgrep 'search pattern' input_file: searches the input file for the specified search pattern and displays the matching lines
finda command used to search for files in a directory treefind /path -name 'pattern': searches the specified path for files with names that match the specified pattern
xargsa command used to build and execute commands from standard input`ls
tara command used to create, maintain, and extract files from a tar archivetar -cvf archive.tar file1 file2: creates an archive named archive.tar containing the specified files
gzipa command used to compress and decompress filesgzip file: compresses the specified file
bzip2a command used to compress and decompress filesbzip2 file: compresses the specified file
gunzipa command used to decompress gzip filesgunzip file.gz: decompresses the specified gzip file
bunzip2a command used to decompress bzip2 filesbunzip2 file.bz2: decompresses the specified bzip2 file
zcata command used to view the contents of a compressed filezcat file.gz: displays the contents of the specified gzip file

© 2023 stoketech.club

Discord Twitter Github Email RSS
Click to Copy
Translate ยป
Scroll to top
  • [Discord]
    • [Text2Image]
  • [Courses]
  • [Cheat Sheets]
    • Cheat Sheet: Linux
    • Cheat Sheet: Python: File Handling
  • [RSS]