4

Must-Know Linux Terminal Commands with Practical Examples

 1 year ago
source link: https://hackernoon.com/must-know-linux-terminal-commands-with-practical-examples
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Must-Know Linux Terminal Commands with Practical Examples

Search icon
see notifications
Notifications
You can now get notified about hottest tech job openings in our Noonifications Newsletters. Subscribe Today! 🔔
Yesterday at 2:16 PM
Enter The Web Development Writing Contest, Round 3 and Win from $2k
Yesterday at 9:54 AM
Read all about our new features: They're Everything, We're Just Ken! 💅
Last Thursday at 4:04 PM
🔍 Discover Anything on HackerNoon with our brand New Search Page 🔥
08/10/2023
The Unity Writing Contest Round 3: Last Chance to Enter! Win from 3k 💰
08/08/2023
Write on Future of AI to win $1000! 🔥🔥🔥
08/04/2023
💰 Calling all DevOps Enthusiasts to Enter the DevOps Writing Contest! $18k in prizes!! 💰
08/04/2023
Poll Update: Do you Still use Meta's Threads? 📊 10% of HackerNoon's Tech Community says Yes. What say ye? Share your thoughts!🗳️
08/02/2023
Find tech jobs from top tech companies on the HackerNoon Jobs Board. Click 'Jobs' on Green Top Nav.
07/31/2023
📢 Poll Alert: Do you still use Threads? Check out the latest on Meta's social platform & share your thoughts! 🗳️ Vote now!
07/31/2023
There's a new poll on the loose: "How are you feeling!?" Cast your vote now!
07/18/2023
🧵 Threads might be Zuck's smartest business move since Instagram - a story by our COO Linh Dao Smooke
07/10/2023
Write on Web App Development, Win from $6,000! 🔥🔥🔥
07/03/2023
💰 Game Devs: Write on #Unity Game Development and Analytics, Win from $3,000! 💰
06/05/2023
🎥 Lights, camera, internet! Check out the trailer for the Web 2.5 Documentary by HackerNoon. Out now!
05/23/2023
HackerNoon Raises $250k at $50M Valuation From Forward Research 👀
05/16/2023
Web3 Backups for All 🙌 All HackerNoon Stories Now Republish on Arweave! Read about it here!
05/16/2023
🏆 HackerNoon Startups of the Year 2023: Voting and Nominations now open! 🏆
05/10/2023
🏆 Let's celebrate startups that (still) survive and thrive! The HackerNoon Startups of the Year 2023 Awards are now Live! 🏆
05/10/2023
⚠️ All writers can now collect emails and grow their newsletter directly on HackerNoon!
04/28/2023
Write on web3, win $1000!
04/03/2023
You can win $1000 by writing a story on #javascript-file-handling
04/03/2023
Share a #branding story to win $1000!
04/03/2023
Write a story on ip-geolocation, win $1000!
04/03/2023
Good news Hackers! Our stats graph has leveled up - see how much time daily people spend reading your stories!
02/23/2023
Annotate any hackernoon stories to win a free t-shirt!
02/13/2023
New Contest Alert: Win BIG with the #web-development and #ecommerce writing contests!
02/13/2023
🚨 WINNERS ALERT 🚨 #growth-marketing Writing Contest Announces Round 4 Results 🕺 💃
01/30/2023
#respectthefuckinggreen mug, OG Tee, and other Hacker Merch at 15% Discount until 1/31/2023
01/18/2023
ChatGPT is on 🔥! What do you think is next for A.I?
12/15/2022
New Writing Contest Launch! Win Up To 500 USD Per Month on #MobileDebugging Stories!
12/05/2022
HackerNoon is a Multi-language Platform: All Top Stories Now Available in 8 Languages
11/28/2022
Start off your week the right way! Here are some must-read top stories from this week, The Trail to the Sea, Culture, The Philosopher's Public Library and more 💚
11/28/2022
Recently laid off from a tech company? Share your story for free on HackerNoon!
11/14/2022
New Week, New Chance to Win from $18,000! Enter #EnterTheMetaverse Writing Contest Now!
11/08/2022
Stable Diffusion AI Image Generation is Now Available in the HackerNoon Text Editor!
11/03/2022
HN Shareholder Newsletter: Green Clock Strikes Noon :-)
10/26/2022
Vote now on HackerNoon weekly polls!
10/26/2022
Highlight any text on a story and HackerNoon will generate beautiful quote images for you to share!
10/26/2022
Don't miss out on the daily top trending stories on HackerNoon! Subscribe to TechBeat to see what people are currently interested about!
09/20/2022
HackerNoon now publishes sci-fi! Read some of our science fiction stories today and submit your own!
09/05/2022
$200k+ in Committed Writer Payouts for HackerNoon Writing Contests. Enter to Win Monthly Prizes!
08/29/2022
see 35 more
Must-Know Linux Terminal Commands with Practical Examples by@orioninsist

Must-Know Linux Terminal Commands with Practical Examples

August 22nd 2023 New Story
5min
by @orioninsist

Muhammet Murat Kurkoglu

@orioninsist

Hi there! I'm Muhammet Murat Kurkoglu, the founder of...

Open TLDRtldt arrow
Read on Terminal Reader
Read this story in a terminal
Print this story
Print this story

Too Long; Didn't Read

The Linux terminal is a powerful tool that allows users to interact with their system through text-based commands. Having a grasp of basic terminal commands is crucial. In this guide, we’ll explore some essential Linux terminal commands along with explanations and practical examples. The guide includes the tar, ls, mkdir, pwd, whoami, ping and date commands.
featured image - Must-Know Linux Terminal Commands with Practical Examples
Your browser does not support theaudio element.
Read by Dr. One (en-US)
Audio Presented by

@orioninsist

Muhammet Murat Kurkoglu

Hi there! I'm Muhammet Murat Kurkoglu, the founder of or...


Receive Stories from @orioninsist


Credibility

The Linux terminal is a powerful tool that allows users to interact with their system through text-based commands. Whether you’re a beginner or an experienced user, having a grasp of basic terminal commands is crucial. In this guide, we’ll explore some essential Linux terminal commands along with explanations and practical examples.

Table of Contents

  • tar - Archiving and Compression
  • rm - Removing Files and Directories
  • ls - Listing Files and Directories
  • history - Command History
  • whoami - Current User
  • uname - System Information
  • ping - Network Connectivity
  • date - Current Date and Time
  • cp - Copying Files and Directories
  • mkdir - Creating Directories
  • pwd - Present Working Directory
  • cd - Changing Directories
  • file - File Type Information
  • head and tail - Viewing File Content
  • echo - Printing to the Terminal
  • more and cat - File Content Display
  • mv - Moving and Renaming Files
  • wc - Word Count and Line Count
  • sort - Sorting Lines in Files
  • grep - Searching for Text
  • Conclusion

1. tar - Archiving and Compression

The tar command is used for archiving and compressing files and folders.

  • Create a compressed archive of a file:
tar -zcvf archive.tar filename
  • Create an archive of multiple files:
tar -zcvf archive2.tar filename1 filename2 filename3
  • Create an archive of a folder:
tar -zcvf folder.tar folder/

2. rm - Removing Files and Directories

The rm command is used to remove files and directories.

  • Remove a directory and its contents:
rm -r folder/
  • Remove multiple files:
rm filename1 filename2 filename3

3. ls - Listing Files and Directories

The ls command lists the contents of a directory.

  • List all files and directories in long format:
ls -al

4. history - Command History

The history command displays previously executed commands.

  • Display command history:
history
  • Clear command history:
history -c

5. whoami - Current User

The whoami command displays the current user.

  • Display current user:
whoami

6. uname - System Information

The uname command provides system information.

  • Display system and kernel information:
uname -a
  • Display kernel release information:
uname -r

7. ping - Network Connectivity

The ping command checks network connectivity to a host.

  • Ping a host four times:
ping -c4 orioninsist.org

8. date - Current Date and Time

The date command displays the current date and time.

  • Display current date and time:
date

9. cp - Copying Files and Directories

The cp command is used to copy files and directories.

  • Copy a file with a new name:
cp filename newfilename
  • Copy a file to a specific directory:
cp filename /home/orion/
  • Copy a directory and its contents recursively:
cp -r /home/orion/newfolder /tmp/newfolder

10. mkdir - Creating Directories

The mkdir command creates directories.

  • Create a new directory:
mkdir newfolder

11. pwd - Present Working Directory

The pwd command displays the present working directory.

  • Display current directory path:
pwd

12. cd - Changing Directories

The cd command is used to change directories.

  • Change to the Desktop directory:
cd Desktop
  • Move up one directory level:
cd ..

13. file - File Type Information

The file command provides information about file types.

  • Determine file type:
file filename.txt

14. head and tail - Viewing File Content

The head and tail commands display the beginning and end of files.

  • Display the first lines of a file:
head filename.txt
  • Display the last lines of a file:
tail filename.txt

15. echo - Printing to the Terminal

The echo command prints text to the terminal.

  • Append new content to a file:
echo "new content" >> filename.txt

16. more and cat - File Content Display

The more and cat commands display file content.

  • Display file content with paging:
more filename.txt
  • Concatenate and display multiple files:
cat filename.txt filename2.txt

17. mv - Moving and Renaming Files

The mv command moves or renames files and directories.

  • Move a file to a new directory:
mv filename newfolder/

18. wc - Word Count and Line Count

The wc command counts words, lines, and characters in a file.

  • Count words in a file:
wc -w filename.txt
  • Count lines in a file:
wc -l filename.txt

19. sort - Sorting Lines in Files

The sort command sorts lines in files.

  • Sort lines in a file:
sort filename.txt
  • Sort lines based on the second field:
sort -k 2 filename.txt

20. grep - Searching for Text

The grep command searches for text in files.

  • Search for a specific pattern:
grep "orion" filename.txt
  • Search for a pattern and exclude matches:
grep -v "orion" filename.txt

Conclusion

These are just a few of the fundamental Linux terminal commands that can empower you to navigate and interact with your system efficiently. As you continue to explore the Linux terminal, you’ll discover even more commands and functionalities that can help you streamline your workflow and manage your system effectively. So, dive in, experiment, and become a master of the Linux command line!

GitHub

⭐ GitHub: https://github.com/orioninsist/linux-basic

Also published here.

by Muhammet Murat Kurkoglu @orioninsist.Hi there! I'm Muhammet Murat Kurkoglu, the founder of orioninsist. I'm a computer engineer with a degree in economics.
Read my stories
L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK