SlideShare a Scribd company logo
1
ssh [ip or hostname]
“vagrant ssh” in the same
directory as the Vagrantfile
to shell into the box/machine
(assumes you have
successfully “vagrant up”)
Secure shell, an encrypted network protocol allowing
for remote login and command execution
On Windows: PuTTY and WinSCP
An “ssh.exe” is also available via Cygwin as well as
with a Git installation.
pwd Print Working Directory
Displays the full path name
whoami Displays your logged in user id
cd /
cd target
cd ~
Change directory to the root of the filesystem
Change directory to “target” directory
Change directory to your home directory
ls
ls -l
ls -la
Directory listing
Long listing, displays file ownership
Displays hidden files/directories
Linux Commands Cheat Sheet
Easy to use Linux shortcuts
for developers.
clear Clear the terminal screen
2
cat file.txt Displays the contents of file.txt to standard out
cat /etc/system-release Displays the contents of the system-release file -
what version of RHEL, Centos or Fedora are you
running?
cat longfile.txt | more Displays the contents of the file with forward paging
less longfile.txt Scroll forward: Ctrl-f
Scroll backward: Ctrl-b
End of file: G
Quit less: q
man cat Man pages, the user manual. In this case, it will de-
scribe the cat command
3
cp source_file.js target_file.js
cp -r ~/source_dir ~/target_dir
Copies a specific file
Copies all files and sub-dirs
mkdir my_directory Create the directory “my_directory”
rm myfile.js
rm -rf my_directory/
Removes a specific file
Removes a directory, recursively
mv [source_file] [target_file] Move file or directory
ps -ef Displays information about a selection of the active
processes
4
./runthisthing Execute a program or shell script in your current
working directory (pwd)
Executable items are have an “x” in their long listing
(ls -la)
./runthisthing & Execute a program or shell script as a background
task
ps -ef | grep runthisthing Find a particular process by name. The “|” is a pipe,
redirects the output of the left-side command to the
standard input of the right-side command
kill -9 [pid]
ip -4 a Shows the IPv4 address for all NICs
5
top What is eating your CPU
which [executable] Where is the executable located
6
echo $PATH Displays the $PATH environment variable
env Displays all ENV variables
export PATH=$PATH:/anoth-
erdir
Adds “anotherdir” to your PATH, just for your current
session
sudo find . -name [file] Find a file or directory by name
echo “Stuff” > target_file.txt
echo “more” >> target_file.txt
single > redirects the output to the file
“target_file.txt”
A double >> appends
7
grep -i stuff `find . -name *.txt
-print`
Find the string “stuff” in all the .txt files
head [file] Output the first part of file (first 10 lines)
curl developers.redhat.com Retrieve the content from developers.redhat.com
source myenvsetting_script.sh How to add something to the PATH and make it stick
By default a new shell is launched to run a script,
therefore env changes are not visible to your current
shell.
Note: the path uses “:” as a separator vs “;” in the
Windows world
sudo yum -y install net-tools “yum” is the installation tool for Fedora, Centos and
RHEL. This command installs “net-tools” which has
many handy utilities like netstat
8
sudo netstat -anp | grep tcp |
grep LISTEN
Lists the various in-use ports and the process using it
sudo netstat -anp | grep 2376 Lists the process listening on port 2376
This is particularly useful when another process is
hanging out on a port you need, like if you started
Apache on 80 or Tomcat on 8080.
wget https://someurl.com/
somefile.tar.gz
wget is a useful utility for downloading files from any
website. If installation is required, simply
sudo yum -y install wget
tar -xf somefile.tar.gz
tar -xf somefile.tar.gz -C ~/so-
medir
Extracts/expands (think unzip) into current directory
Expands into the “somedir” directory
Ad

More Related Content

What's hot (20)

Windows server
Windows serverWindows server
Windows server
Hideo Amezawa
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
 
alphorm.com - Formation Linux LPIC-1/Comptia Linux+
alphorm.com - Formation Linux LPIC-1/Comptia Linux+alphorm.com - Formation Linux LPIC-1/Comptia Linux+
alphorm.com - Formation Linux LPIC-1/Comptia Linux+
Alphorm
 
Cisco router basic
Cisco router basicCisco router basic
Cisco router basic
Tapan Khilar
 
Presentation on linux
Presentation on linuxPresentation on linux
Presentation on linux
Veeral Bhateja
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
linuxlab_conf
 
클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning
클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning 클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning
클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning
Ji-Woong Choi
 
Firewall fundamentals
Firewall fundamentalsFirewall fundamentals
Firewall fundamentals
Thang Man
 
Wireless Cracking using Kali
Wireless Cracking using KaliWireless Cracking using Kali
Wireless Cracking using Kali
n|u - The Open Security Community
 
Mise en place d'un système de messagerie roundcube sous cent os 7
Mise en place d'un système de messagerie roundcube sous cent os 7Mise en place d'un système de messagerie roundcube sous cent os 7
Mise en place d'un système de messagerie roundcube sous cent os 7
Ousmane BADJI
 
Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
mukul bhardwaj
 
Radius1
Radius1Radius1
Radius1
balamurugan.k Kalibalamurugan
 
4. linux file systems
4. linux file systems4. linux file systems
4. linux file systems
Marian Marinov
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network Interfaces
Kernel TLV
 
Vxlan deep dive session rev0.5 final
Vxlan deep dive session rev0.5   finalVxlan deep dive session rev0.5   final
Vxlan deep dive session rev0.5 final
KwonSun Bae
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & Linux
Mr. Vengineer
 
Spi drivers
Spi driversSpi drivers
Spi drivers
pradeep_tewani
 
VMware vSphere Networking deep dive
VMware vSphere Networking deep diveVMware vSphere Networking deep dive
VMware vSphere Networking deep dive
Sanjeev Kumar
 
03 ospf
03 ospf 03 ospf
03 ospf
Claudio Francisco Joaquim Joaquim
 
CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...
CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...
CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...
AMD Developer Central
 
Linux Introduction (Commands)
Linux Introduction (Commands)Linux Introduction (Commands)
Linux Introduction (Commands)
anandvaidya
 
alphorm.com - Formation Linux LPIC-1/Comptia Linux+
alphorm.com - Formation Linux LPIC-1/Comptia Linux+alphorm.com - Formation Linux LPIC-1/Comptia Linux+
alphorm.com - Formation Linux LPIC-1/Comptia Linux+
Alphorm
 
Cisco router basic
Cisco router basicCisco router basic
Cisco router basic
Tapan Khilar
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
linuxlab_conf
 
클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning
클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning 클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning
클라우드 컴퓨팅 기반 기술과 오픈스택(Kvm) 기반 Provisioning
Ji-Woong Choi
 
Firewall fundamentals
Firewall fundamentalsFirewall fundamentals
Firewall fundamentals
Thang Man
 
Mise en place d'un système de messagerie roundcube sous cent os 7
Mise en place d'un système de messagerie roundcube sous cent os 7Mise en place d'un système de messagerie roundcube sous cent os 7
Mise en place d'un système de messagerie roundcube sous cent os 7
Ousmane BADJI
 
Fun with Network Interfaces
Fun with Network InterfacesFun with Network Interfaces
Fun with Network Interfaces
Kernel TLV
 
Vxlan deep dive session rev0.5 final
Vxlan deep dive session rev0.5   finalVxlan deep dive session rev0.5   final
Vxlan deep dive session rev0.5 final
KwonSun Bae
 
Tegra 186のu-boot & Linux
Tegra 186のu-boot & LinuxTegra 186のu-boot & Linux
Tegra 186のu-boot & Linux
Mr. Vengineer
 
VMware vSphere Networking deep dive
VMware vSphere Networking deep diveVMware vSphere Networking deep dive
VMware vSphere Networking deep dive
Sanjeev Kumar
 
CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...
CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...
CE-4028, Miracast with AMD Wireless Display technology – Kickass gaming and o...
AMD Developer Central
 

Similar to Red Hat Linux cheat sheet (20)

Linux Workshop , Day 3
Linux Workshop , Day 3Linux Workshop , Day 3
Linux Workshop , Day 3
Quotient Technology Inc.
 
Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologist
Ajay Murali
 
Linux
LinuxLinux
Linux
sravan kumar
 
Assignment OS LAB 2022
Assignment OS LAB 2022Assignment OS LAB 2022
Assignment OS LAB 2022
INFOTAINMENTCHANNEL1
 
Using the command line on macOS
Using the command line on macOSUsing the command line on macOS
Using the command line on macOS
AdamFallon4
 
Linux Basics
Linux BasicsLinux Basics
Linux Basics
Team-VLSI-ITMU
 
Linux Fundamentals
Linux FundamentalsLinux Fundamentals
Linux Fundamentals
DianaWhitney4
 
Linux
LinuxLinux
Linux
SINGH PROJECTS
 
Unix / Linux Command Reference
Unix / Linux Command ReferenceUnix / Linux Command Reference
Unix / Linux Command Reference
Sumankumar Panchal
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
Muhammad Qazi
 
HISTORY, TYPES OF EMBEDDED LINUX, COMMANDS,
HISTORY, TYPES OF EMBEDDED LINUX, COMMANDS,HISTORY, TYPES OF EMBEDDED LINUX, COMMANDS,
HISTORY, TYPES OF EMBEDDED LINUX, COMMANDS,
KesavanT10
 
Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdf
CesleySCruz
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
Sudharsan S
 
Tutorial 2
Tutorial 2Tutorial 2
Tutorial 2
tech2click
 
linux-commands.ppt
linux-commands.pptlinux-commands.ppt
linux-commands.ppt
saubhagya ranjan
 
linux-commands.ppt
linux-commands.pptlinux-commands.ppt
linux-commands.ppt
AbhishekKumarSrivast36
 
linux-commands.ppt
linux-commands.pptlinux-commands.ppt
linux-commands.ppt
ArliPutraPratama1
 
linux-commands.ppt
linux-commands.pptlinux-commands.ppt
linux-commands.ppt
ArliPutraPratama
 
linux-commands.ppt
linux-commands.pptlinux-commands.ppt
linux-commands.ppt
MeghrajPatil11
 
Linux commands
Linux commandsLinux commands
Linux commands
VenkatakrishnaAdari1
 
Ad

Recently uploaded (20)

Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Ad

Red Hat Linux cheat sheet

  • 1. 1 ssh [ip or hostname] “vagrant ssh” in the same directory as the Vagrantfile to shell into the box/machine (assumes you have successfully “vagrant up”) Secure shell, an encrypted network protocol allowing for remote login and command execution On Windows: PuTTY and WinSCP An “ssh.exe” is also available via Cygwin as well as with a Git installation. pwd Print Working Directory Displays the full path name whoami Displays your logged in user id cd / cd target cd ~ Change directory to the root of the filesystem Change directory to “target” directory Change directory to your home directory ls ls -l ls -la Directory listing Long listing, displays file ownership Displays hidden files/directories Linux Commands Cheat Sheet Easy to use Linux shortcuts for developers. clear Clear the terminal screen
  • 2. 2 cat file.txt Displays the contents of file.txt to standard out cat /etc/system-release Displays the contents of the system-release file - what version of RHEL, Centos or Fedora are you running? cat longfile.txt | more Displays the contents of the file with forward paging less longfile.txt Scroll forward: Ctrl-f Scroll backward: Ctrl-b End of file: G Quit less: q man cat Man pages, the user manual. In this case, it will de- scribe the cat command
  • 3. 3 cp source_file.js target_file.js cp -r ~/source_dir ~/target_dir Copies a specific file Copies all files and sub-dirs mkdir my_directory Create the directory “my_directory” rm myfile.js rm -rf my_directory/ Removes a specific file Removes a directory, recursively mv [source_file] [target_file] Move file or directory ps -ef Displays information about a selection of the active processes
  • 4. 4 ./runthisthing Execute a program or shell script in your current working directory (pwd) Executable items are have an “x” in their long listing (ls -la) ./runthisthing & Execute a program or shell script as a background task ps -ef | grep runthisthing Find a particular process by name. The “|” is a pipe, redirects the output of the left-side command to the standard input of the right-side command kill -9 [pid] ip -4 a Shows the IPv4 address for all NICs
  • 5. 5 top What is eating your CPU which [executable] Where is the executable located
  • 6. 6 echo $PATH Displays the $PATH environment variable env Displays all ENV variables export PATH=$PATH:/anoth- erdir Adds “anotherdir” to your PATH, just for your current session sudo find . -name [file] Find a file or directory by name echo “Stuff” > target_file.txt echo “more” >> target_file.txt single > redirects the output to the file “target_file.txt” A double >> appends
  • 7. 7 grep -i stuff `find . -name *.txt -print` Find the string “stuff” in all the .txt files head [file] Output the first part of file (first 10 lines) curl developers.redhat.com Retrieve the content from developers.redhat.com source myenvsetting_script.sh How to add something to the PATH and make it stick By default a new shell is launched to run a script, therefore env changes are not visible to your current shell. Note: the path uses “:” as a separator vs “;” in the Windows world sudo yum -y install net-tools “yum” is the installation tool for Fedora, Centos and RHEL. This command installs “net-tools” which has many handy utilities like netstat
  • 8. 8 sudo netstat -anp | grep tcp | grep LISTEN Lists the various in-use ports and the process using it sudo netstat -anp | grep 2376 Lists the process listening on port 2376 This is particularly useful when another process is hanging out on a port you need, like if you started Apache on 80 or Tomcat on 8080. wget https://someurl.com/ somefile.tar.gz wget is a useful utility for downloading files from any website. If installation is required, simply sudo yum -y install wget tar -xf somefile.tar.gz tar -xf somefile.tar.gz -C ~/so- medir Extracts/expands (think unzip) into current directory Expands into the “somedir” directory