Explore more advanced terminal shortcuts?

QuestionsQuestions4 SkillsProDec, 20 2025
0191

Ready to level up? Since you've mastered the basics, here are some advanced terminal shortcuts and tricks that "power users" use to work faster in the LabEx environment.

1. Advanced History Manipulation

Beyond just the arrow keys, you can interact with your command history using the ! (exclamation mark) operator:

  • !string: Runs the most recent command that starts with "string". For example, !da would automatically run date if that was your last command starting with those letters.
  • !$: This represents the last argument of the previous command.
    • Example: If you just typed echo "Hello LabEx", you could then type print !$ and it would act as if you typed print "Hello LabEx".
  • history: Type this command to see a numbered list of every command you've typed in this session.

2. Powerful Process Management

  • Ctrl + Z: Suspends (pauses) a running process and puts it in the background. You can get back to it later by typing fg (foreground).
  • Ctrl + S: Freezes the terminal output (useful if a lot of text is scrolling by too fast to read).
  • Ctrl + Q: Unfreezes the terminal after using Ctrl + S.

3. Cursor "Surgery"

If you have a very long command and made a typo in the middle:

  • Alt + D: Delete the word after the cursor.
  • Ctrl + T: Swap the character under the cursor with the one before it (great for fixing typos like ecko to echo).
  • Alt + T: Swap the current word with the previous word.

4. Terminal Control

  • Ctrl + Shift + C / Ctrl + Shift + V: These are often used for Copy and Paste inside the Linux terminal (since Ctrl+C is reserved for stopping processes).
  • reset: If your terminal screen gets "garbled" with strange symbols (which sometimes happens if you try to read a binary file), typing reset re-initializes the entire terminal window settings.

5. Multi-Command Magic

You can run multiple commands at once using these symbols:

  • ; (Semicolon): Run commands one after another.
    • Try: clear; date; cal
  • && (Logical AND): Run the second command only if the first one was successful.
    • Try: echo "Success" && date

Challenge: Try combining them! Type clear && echo "The date is:" && date.

Which of these feels like it would save you the most time?

0 Comments

no data
Be the first to share your comment!