DEV Community

Cover image for Useful and cool Linux tricks
Atul Anand Oraon
Atul Anand Oraon

Posted on

Useful and cool Linux tricks

Hi folks

I recently joined th community fcall on the discord server of the Growin Community. There we had a Linux session in which we learn't quite some handy tricks with the Linux.

If you do not own a linux machine do not worry. You can use

1 Killer koda
Just choose the ubuntu from here
2 copy.sh

Alright you are all set to get your hands on the terminal.

3,2, 1 Go 🔫🚀

LINUX Tricks

  • To execute a previous command:

    • history — prints the history of commands.
    • !<cmd_no> — executes a command from history based on its number.
  • To copy and paste lines in vim:

    • Esc + 10yy — copies 10 lines.
    • Paste with p to insert after the cursor.
  • To perform a reverse search:

    • Ctrl+R — reverse search through the command history.
  • To count lines in a file:

    • wc -l aks.txt — counts and lists the number of lines.
  • Yanking (copying) in vim:

    • yy — yanks (copies) the current line.
    • Esc + 5yy — yanks (copies) 5 lines.
    • Paste with p after yanking.
  • Navigating in vim:

    • Esc + :1 — jumps to line 1.
    • :set nu — enables line numbers.
    • Esc + Shift+G — moves to the end of the document.
  • Deleting in vim:

    • Esc + dG — deletes everything from the current line to the end of the document.
    • Esc + u — undoes the last change.
  • Finding unique adjacent lines in a file:

    • uniq -c — looks for unique adjacent lines.
  • Sorting, unique filtering, and counting occurrences:

    • cat aks.txt | sort | uniq -c — lists all unique lines in aks.txt with their counts after sorting.

That's it you got a lot from this article do like it and share any comments
you want to. DO not shy away.

See you next time

Image of Datadog

Master Mobile Monitoring for iOS Apps

Monitor your app’s health with real-time insights into crash-free rates, start times, and more. Optimize performance and prevent user churn by addressing critical issues like app hangs, and ANRs. Learn how to keep your iOS app running smoothly across all devices by downloading this eBook.

Get The eBook

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay