
Command Line and Terminal navigation Cheat Sheet by Kyngo (Kyngo) via cheatography.com/131267/cs/26366/ Basics Basics (cont) Basics (cont) cd [path] change your current directory rm [file] removes a file less [file] prints a file using pagination to the specified one rm -rf removes a folder and all of its more [file] same as less [file] cd ~ go to your home folder [file] contents ln -s makes a symbolic link of a cd - go the the folder you were cat [file] prints a file's contents [source] given source at the given before tac [file] prints a file's contents from [desti‐ destina tion ls list the contents of the bottom to top nation] directory sed allows replacing of contents in cal prints a calendar on the ls -lh list the contents of the files with regular express ions terminal directory in a human-f rie ndly grep prints the contents of a given date reports the current date and format [pattern] file that match the given pattern time cp [origin] copies the given file wherever [file] Write (or append to) a file without an [desti‐ you want to tr -s replaces all concurrent editor nation] [pattern] duplicates of a given pattern mv [origin] moves or renames the given tr replaces the given pattern with cat > [file] << EOF [desti‐ file [pattern] the given replace ment string hello world nation] [repla‐ this is a file's content pwd get the current directory you're cement] blah blah blah in tr -d removes the given pattern from hello again mkdir create a folder [pattern] a string bye for now EOF [name] head prints the first lines of a given mkdir -p create a folder and all its [file] file In order to append to a file instead of [name] parents, if needed tail [file] prints the last lines of a given replacing all of its contents, add two output chmod change a file's permiss ions - file cones instead of only one (>>). 755 Allows the user to read, write cut -f allows you to print specific Command pipeline concate nation [name] and execute, and anyone else [field] -d fields from an origin that have a example to just read and execute [separ‐ given separator chmod change a file's permiss ions - ator] curl https:/ /de vel ope r.an dr oi‐ 400 Only the owner will be able to uname gets the OS kernel's name d.com/studio#downloads | grep [name] read the file (Linux, Darwin...) ".dmg " | grep href | head -n1 | cut -f2 -d"=" | tr -d '"' chown changes the owners of a given uname - gets the machine's archite cture This command will: user:group file or folder m (if not within an emulator) [name] - download the downlaods page for Android uname -r gets the kernel version Studio chown -R changes the owners of a given uname - shows all the details of your - find for the lines that contain ".dmg " within user:group file or folder, and all of its a UNIX OS them [name] contents - filter again to get only those that contain "‐ touch creates a file with the given href " [name] name - filter again to get only the first occurrence file [name] reports the file type - split the result to get only the second field using = as a separator - remove any double quotation marks on the string By Kyngo (Kyngo) Published 29th January, 2021. Sponsored by ApolloPad.com cheatography.com/kyngo/ Last updated 4th May, 2021. Everyone has a novel in them. Finish arnaumart.in Page 1 of 4. Yours! https://apollopad.com Command Line and Terminal navigation Cheat Sheet by Kyngo (Kyngo) via cheatography.com/131267/cs/26366/ Command pipeline concate nation Networks Pipelines and operators (cont) example (cont) ifconfig Shows a general network brief [command] appends a file's contents The result should be a link that, when ip addr Same as ifconfig but on << [file] into the program opened, will download the macOS installer show Linux [command1] if command1 succeeds, for Android Studio. nmap Scans the ports of the given IP && command2 will be executed Please note, if the website changes, this [ip]/32 [command2] command may not work as is. ping Send a sequence of ICMP [command1] if command1 fails, || command2 will be executed Manuals [host] packets to a host [command2] whois Tells you informa tion about the Almost all programs on any Unix OS will [host] domain & the process will be run in the have what's called a "m anp age ". This is an background instruc tion manual with details on how to dig Tells you how a specific !! the last executed command use a program. [domain] domain resolves In order to read the manual for a specific nslookup The same as dig [domain] $? the last command's exit applica tion, just type man [applic ati on] [domain] code and you will be able to read how it works. host Reports several types of [command1] sends the output of Press "Q " to close the manual when you're [domain] records for a given domain | command1 to command2's done. [command2] input wget [url] Downloads the given URL to -O [file] the specified file [command] \ allows you to make a line sed examples break without executing the curl [url] - Downloads the given URL to The sed command uses a string as command o [file] the specified file parameter to determine what to oeprate, [command] redirects the command's iftop Allows you to monitor the and can receive several more parameters to 2>&1 stderr to stdout network throughput (Linux) configure the behavior. `[com‐ runs the given command, netstat - Shows which applica tions are sed -i 's/hell o/hi/' file.txt will mand]` and then runs the result as a tulpn using what ports (Linux) replace the first instance of "h ell o" that the command itself script can find at each line, and write the sudo lsof Shows which applica tions are result at the same given file. To avoid -i -n -P using what ports (macOS) Remote hosts overwri ting, you can just remove the -i ssh [server] connects to a server via argument. Pipelines and operators SSH sed -i 's/hell o/h i/g' file.txt [command] outputs the result of a ssh [server] -p [port] will replace every instance of "h ell o" that > [file] command to a file exist in the file. ssh [server] -i [certif icate] [command] outputs the result of a To apply the patterns from a file, use the - >> [file] command to the end of a file scp [user]@[s‐ copies a file from a fpar ameter with a path to a file. erve r]: [path] remote server to your [command] gets a file and prints its If you want to make a backup of the file, add [local path] machine < [file] content as if it were you a suffix for said file after the -i parameter. entering it telnet [host] makes a raw tcp For example: [port] connection to a given sed -i".bk p" 's/hell o/h i/g' host and port file.txt will generate a file named w reports who's file.tx t.bkp with the original contents. connected at the Regular express ions can be applied to the machine pattern given to sed, as maybe you want to who same as w replace something that may not be an exact string, but rather a pattern of it. By Kyngo (Kyngo) Published 29th January, 2021. Sponsored by ApolloPad.com cheatography.com/kyngo/ Last updated 4th May, 2021. Everyone has a novel in them. Finish arnaumart.in Page 2 of 4. Yours! https://apollopad.com Command Line and Terminal navigation Cheat Sheet by Kyngo (Kyngo) via cheatography.com/131267/cs/26366/ Remote hosts (cont) Loops and decision taking (cont) Package Managers (cont) whoami tells you your username done choco Windows (Chocol atey) For SCP, you can upload from your "If-else if-else" operator Searching machine to a remote server by changing the if [ $UID -eq 0 ] order of the commands. You can also use then find [path] finds anything within a given SSH's parameters with SCP (for port, you echo You are root -name path with a given pattern on must use -P (capita l)). elif [ $UID -eq 1 ] [name its name echo You are user with ID 1 pattern] Environ ment variables else whereis tells you all the locations for a echo You are NOT root PATH the directo ries where the shell [name] given binary name fi will find for the command which tells you the given binary binaries [name] name's path that will be run Permission bits HOME your home directory according to your PATH 0 --- Do nothing UID the user ID locate tells you the location of any 1 --x Execution [name] kind of file within your EUID the user ID running the machine command 2 -w- Write SHELL your current shell 3 -wx Execute and write Monitoring the OS PS1 your prompt's style 4 r-- Read ps prints a snapshot of all system 5 r-x Read and execute PWD your current directory aux processes 6 rw- Read and write RANDOM random number top shows the processes running on HOST the host's name 7 rwx Read, write and execute the machine LANG the shell's language Here "r " stand for "r ead ", "w " stands for "‐ htop shows the processes running on TTY your current session's TTY writ e", and "x " stands for "e xec ute ". It may the machine with some graphs for be useless to have permiss ions below 4, as memory usage Loops and decision taking you won't be able to read the file.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-