blog.devgenius.io
Open in
urlscan Pro
162.159.153.4
Public Scan
Submitted URL: https://shly.link/uA4zC
Effective URL: https://blog.devgenius.io/71-linux-commands-for-platform-engineering-563cf8f16c5?gi=379be2a8c035
Submission: On December 27 via manual from RU — Scanned from DE
Effective URL: https://blog.devgenius.io/71-linux-commands-for-platform-engineering-563cf8f16c5?gi=379be2a8c035
Submission: On December 27 via manual from RU — Scanned from DE
Form analysis
0 forms found in the DOMText Content
Open in app Sign up Sign In Write Sign up Sign In Published in Dev Genius You have 2 free member-only stories left this month. Sign up for Medium and get an extra one Peng Cao Follow Nov 29 · 6 min read · Member-only · Listen Save 71 LINUX COMMANDS FOR PLATFORM ENGINEERING This article aims to explain and demo 71 frequently used commands for platform engineering. Checkout if you missed any in your toolbox. Let’s dive in… 1. LS — LIST DIRECTORY CONTENTS $ ls $ Desktop Documents Downloads Music Pictures Public Templates Videos 2. CD — CHANGE DIRECTORY #change to Desktop directory $ cd Desktop #change to parent directory $ cd .. 3. PWD — PRINT NAME OF CURRENT/WORKING DIRECTORY $ pwd $ /home/username 4. MKDIR — MAKE DIRECTORIES #make a directory named test1 $ mkdir test1 5. RMDIR — REMOVE EMPTY DIRECTORIES #remove directory named test1 $ rmdir test1 6. RM — REMOVE FILES OR DIRECTORIES #remove file named test1 $ rm test1 #remove directory named test1 and all its contents $ rm -r test1 7. CP — COPY FILES AND DIRECTORIES #copy file named test1 to test2 $ cp test1 test2 #copy directory named test1 to test2 and all its contents $ cp -r test1 test2 8. MV — MOVE (RENAME) FILES #rename file named test1 to test2 $ mv test1 test2 create a file named test and write 'Hello World!' to it $ echo 'Hello World!' > test # CAT VS MORE VS LESS VS HEAD VS TAIL VS GREP # cat: print the whole file # more: print the file page by page # less: print the file page by page # head: print the first 10 lines of the file # tail: print the last 10 lines of the file # grep: print lines matching a pattern 9. CAT — CONCATENATE FILES AND PRINT ON THE STANDARD OUTPUT $ cat test $ Hello World! 10. MORE — PAGE THROUGH A FILE $ more test $ Hello World! 11. LESS — PAGE THROUGH A FILE $ less test $ Hello World! 12. HEAD — OUTPUT THE FIRST PART OF FILES $ head test $ Hello World! 13. TAIL — OUTPUT THE LAST PART OF FILES $ tail test $ Hello World! 14. TOUCH — CHANGE FILE TIMESTAMPS #create a file named test $ touch test 15. GREP — PRINT LINES MATCHING A PATTERN $ grep “Hello” test $ Hello World! 16. WC — PRINT NEWLINE, WORD, AND BYTE COUNTS FOR EACH FILE $ wc test $ 1 2 13 test 17. SORT — SORT LINES OF TEXT FILES $ sort test $ Hello World! 18. UNIQ — REPORT OR OMIT REPEATED LINES $ uniq test $ Hello World! 19. FIND — SEARCH FOR FILES IN A DIRECTORY HIERARCHY $ find . -name test $ ./test 20. DIFF — COMPARE FILES LINE BY LINE $ touch test2 $ diff test test2 $ 1c1 $ < Hello World! 21. CHMOD — CHANGE FILE MODE BITS #change file mode bits to 777 $ chmod 777 test 22. CHOWN — CHANGE FILE OWNER AND GROUP #change file owner to username $ chown username test 23. CHGRP — CHANGE GROUP OWNERSHIP #change file group to username $ chgrp username test 24. LN — MAKE LINKS BETWEEN FILES #create a symbolic link named test2 to test $ ln -s test test2 25. DF — REPORT FILE SYSTEM DISK SPACE USAGE $ df $ Filesystem 1K-blocks Used Available Use% Mounted on 26. DU — ESTIMATE FILE SPACE USAGE $ du $ 4 ./test 27. FREE — DISPLAY AMOUNT OF FREE AND USED MEMORY IN THE SYSTEM $ free $ total used free shared buff/cache available for mac users, use `sysctl vm.swapusage` 28. TOP — DISPLAY LINUX PROCESSES $ top Processes: 479 total, 8 running, 471 sleeping, 3537 threads 21:32:04 Load Avg: 5.17, 5.70, 6.10 CPU usage: 21.25% user, 10.80% sys, 67.94% idle SharedLibs: 394M resident, 96M data, 28M linkedit. MemRegions: 758491 total, 2744M resident, 95M private, 3890M shared. PhysMem: 15G used (2000M wired, 6187M compressor), 62M unused. VM: 237T vsize, 4142M framework vsize, 12854576(8) swapins, 13758210(0) swapouts. Networks: packets: 26370117/21G in, 16967790/4569M out. Disks: 17897519/548G read, 9830492/344G written. PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP PPID 16988 qemu-system- 41.2 13:53:21 13/1 0 29 19G 0B 17G+ 16916 16965 161 WindowServer 38.6 03:19:47 22 6 2926- 968M- 5184K+ 150M- 161 1 19778 Google Chrom 33.7 01:57:56 21/1 1 706 472M+ 0B 362M+ 2664 2664 0 kernel_task 21.1 04:48:40 522/8 0 0 2272K 0B 0B 0 0 29. KILL — KILL A PROCESS #kill process with pid 1234 $ kill 1234 30. PS — REPORT A SNAPSHOT OF THE CURRENT PROCESSES $ ps $ PID TTY TIME CMD 1234 pts/0 00:00:00 bash 1235 pts/0 00:00:00 ps 31. SUDO — EXECUTE A COMMAND AS ANOTHER USER #install vim $ sudo apt-get install vim 32. SU — BECOME ANOTHER USER #become user username $ su username 33. APT-GET — INSTALL, REMOVE, OR UPDATE SOFTWARE PACKAGES #install vim $ apt-get install vim 34. APT-CACHE — SEARCH FOR PACKAGES #search for vim $ apt-cache search vim 35. APT — COMMANDLINE PACKAGE MANAGER #install vim $ apt install vim 36. YUM — INSTALL, REMOVE, OR UPDATE SOFTWARE PACKAGES #install vim $ yum install vim 37. YUM — SEARCH FOR PACKAGES #search for vim $ yum search vim 38. WGET — NON-INTERACTIVE NETWORK DOWNLOADER #download google.com $ wget https://www.google.com 39. CURL — TRANSFER A URL #download google.com $ curl https://www.google.com 40. TAR — CREATE, EXTRACT, OR LIST FILES FROM A TAR FILE #extract test.tar $ tar -xvf test.tar 41. GZIP — COMPRESS OR EXPAND FILES #compress test $ gzip test 42. GUNZIP — UNCOMPRESS .GZ FILES #uncompress test.gz $ gunzip test.gz 43. ZIP — PACKAGE AND COMPRESS (ARCHIVE) FILES #compress test to test.zip $ zip test.zip test 44. UNZIP — EXTRACT AND LIST FILES FROM A ZIP ARCHIVE #extract test.zip $ unzip test.zip 45. SSH — SECURE SHELL (REMOTE LOGIN PROGRAM) #login to host as username $ ssh username@host 46. SCP — SECURE COPY (REMOTE FILE COPY PROGRAM) #copy test to host as username $ scp test username@host:~ 47. RSYNC — A FAST, VERSATILE, REMOTE (AND LOCAL) FILE-COPYING TOOL #copy test to host as username $ rsync -avz test username@host:~ 48. PING — SEND ICMP ECHO_REQUEST TO NETWORK HOSTS #ping google.com $ ping www.google.com 49. IFCONFIG — CONFIGURE A NETWORK INTERFACE #show network interfaces $ ifconfig 50. NETSTAT — PRINT NETWORK CONNECTIONS, ROUTING TABLES, INTERFACE STATISTICS, MASQUERADE CONNECTIONS, AND MULTICAST MEMBERSHIPS #show network connections $ netstat Active Internet connections Proto Recv-Q Send-Q Local Address Foreign Address (state) tcp4 0 0 192.168.86.67.63586 dns.google.https ESTABLISHED tcp4 0 0 192.168.86.67.63565 ec2-34-229-201-4.https ESTABLISHED tcp4 0 0 192.168.86.67.63563 server-13-227-25.https ESTABLISHED tcp4 0 0 192.168.86.67.63119 lb-140-82-113-26.https ESTABLISHED 51. WHOIS — CLIENT FOR THE WHOIS DIRECTORY SERVICE #show whois information for google.com $ whois www.google.com 52. DIG — DNS LOOKUP UTILITY #show DNS information for google.com $ dig www.google.com 53. HOST — DNS LOOKUP UTILITY #show DNS information for google.com $ host www.google.com 54. NSLOOKUP — QUERY INTERNET NAME SERVERS INTERACTIVELY #show DNS information for google.com $ nslookup www.google.com 55. KILLALL — KILL PROCESSES BY NAME #kill all firefox processes $ killall firefox 56. PASSWD — CHANGE USER PASSWORD #change password $ passwd 57. SSH-KEYGEN — SSH KEY PAIR GENERATOR #generate ssh key pair $ ssh-keygen 58. SSH-COPY-ID — INSTALL SSH PUBLIC KEY #copy ssh public key to host as username $ ssh-copy-id username@host 59. SSH-AGENT — RUN A PROGRAM WITH AN IDENTITY FROM AN AUTHENTICATION AGENT #run bash with ssh-agent $ ssh-agent bash 60. SSH-ADD — ADD IDENTITIES TO THE AUTHENTICATION AGENT #add ssh private key to ssh-agent $ ssh-add ~/.ssh/id_rsa 61. SSH — SECURE SHELL (REMOTE LOGIN PROGRAM) #login to host as username $ ssh username@host 62. SCP — SECURE COPY (REMOTE FILE COPY PROGRAM) #copy test to host as username $ scp test username@host:~ 63. RSYNC — A FAST, VERSATILE, REMOTE (AND LOCAL) FILE-COPYING TOOL #copy test to host as username $ rsync -avz test username@host:~ 64. LSOF — LIST OPEN FILES #list open files $ lsof 65. SSH — SECURE SHELL (REMOTE LOGIN PROGRAM) #tunnel port 80 on host as username to port 8080 on localhost $ ssh -L 8080:localhost:80 username@host 66. IFCONFIG — CONFIGURE A NETWORK INTERFACE #show network interfaces $ ifconfig 67. NETSTAT — PRINT NETWORK CONNECTIONS, ROUTING TABLES, INTERFACE STATISTICS, MASQUERADE CONNECTIONS, AND MULTICAST MEMBERSHIPS #show network connections $ netstat 68. SSHFS — FILESYSTEM CLIENT BASED ON SSH FILE TRANSFER PROTOCOL #mount host as ~/host $ sshfs username@host:~ ~/host 69. AWK — PATTERN SCANNING AND PROCESSING LANGUAGE #print first column of test $ awk '{print $1}' test 70. SED — STREAM EDITOR FOR FILTERING AND TRANSFORMING TEXT #replace Hello with Hi in test $ sed 's/Hello/Hi/g' test 71. CRONTAB — MAINTAIN CRONTAB FILES #edit crontab $ crontab -e Call for Action If you find the guide helpful, feel free to clap and follow me. Join medium via this link to access all premium articles from me and all other awesome writers here on medium. Linux Platform Engineering Programming Command Line Dev Ops 80 80 4 80 4 SIGN UP FOR DEVGENIUS UPDATES BY DEV GENIUS Get the latest news and update from DevGenius publication Take a look. By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices. Get this newsletter MORE FROM DEV GENIUS Follow Coding, Tutorials, News, UX, UI and much more related to development Entreprogrammer ·Nov 29 Member-only USE THE ‘TRIANGLE METHOD’ TO CATCH A LYING COWORKER OR BOSS Using it for a while, and it makes life easier… — It’s an undoubted truth that people lie often. They manipulate others for their gain. It’s a common issue that most of us are now familiar with. According to Karen Donaldson, an expert in communication and body language, those prone to manipulation often fit into one of two types. First, some… Technology 4 min read Technology 4 min read -------------------------------------------------------------------------------- Share your ideas with millions of readers. Write on Medium -------------------------------------------------------------------------------- l0ckD2wN ·Nov 29 #7.4 ELIF-STATEMENTS — PYTHON FOR BEGINNERS The other if’s — Yet, we can only use if and else. So we can check for one condition. If it’s True we run the if-code block, if not the else-code block, no matter another condition. Now we want to check for other conditions as well. … Python 3 min read Python 3 min read -------------------------------------------------------------------------------- Akash Shekhavat ·Nov 29 SQL: INJECTION ATTACK What is SQL Injection? SQLi is a kind of attack in web based application where the attacker canrun malicious queries in the a website’s database. SQL is a code injection technique used to execute malicious SQL statements. For example, if you want to login to the website and you forgotten the username and password… Sql Injection 6 min read Sql Injection 6 min read -------------------------------------------------------------------------------- Jay Byte ·Nov 28 WHY YOU SHOULD WRITE YOUR OWN DATABASE — AN INSIGHT FROM MY TELEGRAM USERS CACHING When I was building an authorization flow involving Telegram bot, I had one specific problem in my current project: how to map user nicknames to chat ids (as it was required for private conversation with bot)? Well, I can simply have a hashmap for it: So far so good… But…… Golang 7 min read Golang 7 min read -------------------------------------------------------------------------------- Mohab erabi ·Nov 28 KOTLIN PROGRAMMING LANGAUGE THE COMPLETE LEARNING GUIDE [2022] 4/6 NULLABILITY AND NULL SAFETY Learn Kotlin one of the most powerful and useful programming languages and make yourself ready to start developing powerfull native mobile apps and other platforms development Nullability and Null safety Section History null pointer was first invented by Tony Hoare in 1965 as part of the ALGOL W language In reference Hoare describes his invention… Kotlin 4 min read Kotlin 4 min read -------------------------------------------------------------------------------- Read more from Dev Genius RECOMMENDED FROM MEDIUM Pavan Belagatti in ITNEXT IMPLEMENTING DEVOPS FOR C AND C++ PROJECTS Kayode Adeniyi SET UP RAILS 5 ACTIONCABLE WITH SMILES Gautam Kothari JAVA TRICKY PROGRAMS (PART — 2) Metasoft Metaelfland DINGDANGSQ AMA Charan FIRE UP GRAPHLAB CREATE Crust Network in CrustNetwork CRUST PROJECT DEVELOPMENT — JULY 26 — AUGUST 01 Michael Bundick THE WAY OF THE RUBBER DUCK 2 Dhaval Soni AMAZON EMR ON EKS RELEASES CUSTOM IMAGE VALIDATION TOOL TO SIMPLIFY TESTING OF YOUR CUSTOMIZED… AboutHelpTermsPrivacy -------------------------------------------------------------------------------- GET THE MEDIUM APP PENG CAO 880 Followers Writing Tech and money-making guide; Happy to build connections with all; Getting more energy with UPowr — Delivering an electrified future, faster! Follow MORE FROM MEDIUM Michael Cassidy in AWS in Plain English TERRAFORM: AWS THREE-TIER ARCHITECTURE DESIGN Mark Vassilevskiy 5 UNIQUE PASSIVE INCOME IDEAS — HOW I MAKE $4,580/MONTH Frank Andrade in Geek Culture HEY CHATGPT, AUTOMATE THESE TASKS USING PYTHON Tiexin Guo in 4th Coffee 10 NEW DEVOPS TOOLS TO WATCH IN 2023 Help Status Writers Blog Careers Privacy Terms About Text to speech To make Medium work, we log user data. By using Medium, you agree to our Privacy Policy, including cookie policy.