This exercise is designed to get you familiar with the Ubuntu command-line editing features. It also introduces you to the concept of command-line history.

Follow these steps

  1. Type the words "We all love Ubuntu" (without the quotation marks) but do not press Enter.
  2. Press the left arrow key to move the cursor to the letter "a" in the word "all".
  3. Press Alt+D to delete the word "all".
  4. Re-type the word "all" at the present cursor position.
  5. Press Ctrl+A to move the cursor to the beginning of the command line.
  6. Press the right arrow key to move the cursor to the letter "l" in "love".
  7. Press Ctrl+K to delete the line from the current cursor position.
  8. Press Ctrl+A and then press Ctrl+K to delete the entire line.
  9. Type "echo $SHELL" and press Enter.
  10. Type "date" and press Enter.
  11. Type "cal" and press Enter.
  12. Press the up arrow three times. You should see "echo $SHELL" on the current command line. Press the down arrow once. The current line will show "date". Now press Enter.
  13. Type "clear" and press Enter.

Dani AI

Generated

's step-by-step drill is a great, low-friction way to build muscle memory for shell editing and history; it teaches the basic motions that make interactive work faster. 's quick endorsement is deserved — repetition turns these into reflexes.

Bash gets its line-editing behavior from the GNU Readline library, so the editing model is configurable. One useful extension is to try vi-style editing (set -o vi) if you already use vi/vim — it gives normal/insert modes and lets you use familiar vi motions to edit long commands. Another immediate time-saver is reverse incremental search (start it with Ctrl+R) to find previous commands quickly instead of paging through the history.

History itself is useful beyond scrolling: list entries with history, recall specific items by number or prefix (history expansion like !123 or !grep), and always review expansions before executing them. For customization, keep small, safe tweaks in your init files so they survive restarts.

# ~/.bashrc
set -o vi

# ~/.inputrc
set completion-ignore-case on

If meta/Alt-based shortcuts behave inconsistently, use an Escape prefix (press Escape, then the desired key) or enable the terminal option that treats Option/Alt as Meta (Terminal/iTerm2, PuTTY, etc.). If arrow keys or other sequences print raw escapes, check your TERM setting (for example xterm-256color) and your emulator's key settings. These small adjustments extend 's exercise into a practical, personalized workflow.

very cool!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.