Typical Linux commands thread January 21, 2022, 06:26:45 pm Hey guys,I've been using linux for a while and I'm looking back at my written notes on linux shell use. I'm trying to type them in my computer to be a bit more organized (and in case I lose my notes, I have something backed up). I thought as I slowly get them into my computer that I would share with you guys what I've learned. I'll fix it up as I have more time and let me know if something doesn't look right... anyways Enjoy.General command syntax ls – shows list of a directorycd – change directory cd ~ ~ shows user home folder changes your directory to the home foldercd - the - at the end of cd brings you to the previous directory sort – sorts based on alphabet? sort – sorts out redundancies in a file sort -u dupes.txt -u unique (no repeating lines) grep – basically searched files with specific keywords in them grep – search files for text that matches a given pattern. grep “the” poems.txt Basically find where the word “the” shows up in poems.txt man – view the reference manual or man page for a specific command (-h works too)ls -l does more info in the listmkdir – makesdirecotry rm – removescp – copy EX: First file is the copied file, second file is the pasted cp hello.txt hello_there.txt. shows us our current directorysu root – maintains super user rightscat – concatenate and print filesvi – open vin text editor In shellfind - command looks for files EX: find . -name “do*” . – find file in current directory -name – find file by name “do*” – find file with the name do followed by any character afterwardsQuick ButtonsCTRL+SHIFT+(+) makes the font biggerCTRL+A – moves to the beginning of the lineCTRL+E – moves to the end of the lineCTRL+left arrow – moves backwards a wordCTRL+right arrow – moves forward a wordCTRL+U – deletes from cursor to the beginning of the lineCTRL+k – deletes from cursor to the end of lineCTRL+SHIFT+C – copy to clipboardCTRL+SHIFT+V – paste from clipboardFile permissions rwxrwxrwx the_file you can look at it as rwx – user: rwx - group : rwx - others First group of rwx is the user Second group is the group Third group is the others R – read W – write X - executeChmod – changes the perissions on a file by modifying the file made bits There are different things for representations Octal (755, 644) Symbolic (=, -, +) To change permissions for all users in a directory Chmod a-x test.shTable Read (4 points) Write (2 points) Execute (1 point) ResultUser R W X 7Group R - X 5Others R - - 4Symbolic Read Write Execute ResultUser (u) + + + U=rwxGroup (g) = - - G = rOthers (o) - - - O = nothingChown – change ownershipMiscwildcards - are characters that stand for patters (*) any number of characters ? one of any charactersudo -k – gets out of sudo./ - executes a program ./calculator| - (pipe character) takes the output of one command and sends it to another. Type it in between commandsecho – same thing as print or echo in phpcat – concatenate and print fileshead and tails – command lets us see the beginning and the end of the text file. Head poems.txt-n – in head shows how many lines after you gonna showawk and sed – tools that extract or modify text from a file or stream awk ‘{print $2}’ simple_data.txt sed s/orange/red/ simple_data.txt s substitutes every occurrence of orange with redtar files – type archive files Basically they are files within a big file Tar -cvf myfile.tar Exercisefiles/ -c create an archive -v list out each file that gets added to the archive -f output to a fileTo find your distribution type: Cat /etc/*-release or uname -afree -h shows your ramcat /proc/cpuinfo Shows random things within the computer(for fedora) sudo dnf install nano dnf shows what you are about to install on the machine(for ubuntu (Debian)) sudo apt-get update Advanced package toolCloning things from github: git clone git://github.com/<github directory>
Re: Typical Linux commands thread Reply #1 – January 21, 2022, 06:26:57 pm You should definitely know about: https://github.com/chubin/cheat.sh
Re: Typical Linux commands thread Reply #2 – January 21, 2022, 06:27:09 pm linux-commands-cheat-sheet-new.pdf > https://docdro.id/oQU2bTG
Re: Typical Linux commands thread Reply #4 – January 21, 2022, 06:27:33 pm Ok, this is amazing. Thanks for this.