DEV Community

Cover image for 🐧 Linux Basics: Aliases, MOTD, Quotes, Variables & Common Issues
SAHIL
SAHIL

Posted on

🐧 Linux Basics: Aliases, MOTD, Quotes, Variables & Common Issues

Welcome to a little tour of some underrated but very useful Linux goodies. Whether you're new to the terminal or just polishing your skills β€” this post is for you! πŸ”§πŸš€


πŸ”Ή 1. Aliases in Linux

πŸ“ What’s an alias?

Aliases are shortcuts for long commands. They save time and prevent finger fatigue (yes, that's a thing! πŸ˜…).

alias ll='ls -lah'
alias gs='git status'
Enter fullscreen mode Exit fullscreen mode

So if you run ll in your terminal in backend ls -lah will be running,but if you close the terminal all aliases will be removed.

🧠 Pro Tip:

Make aliases permanent by adding them to your ~/.bashrc or ~/.bash_aliases file:

echo "alias ..='cd ..'" >> ~/.bashrc
source ~/.bashrc  (this is to reload the terminal)
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή 2. MOTD – Message of the Day

Ever wonder what that message is when you SSH into a server? That’s the MOTD (Message of the Day). It’s like a welcome banner, but nerdier. πŸ€“

πŸ“ Location:

  • Static MOTD: /etc/motd
  • Dynamic MOTD (Ubuntu): /etc/update-motd.d/

✏️ Edit the MOTD:

sudo nano /etc/motd
Enter fullscreen mode Exit fullscreen mode

🚫 Disable Dynamic MOTD:

sudo chmod -x /etc/update-motd.d/*
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή 3. Variables in Linux πŸ§ͺ

Variables in Linux are like containers 🧺 that store values β€” super useful in scripting.

name="sahil"
echo "Hello $name"  # Outputs: Hello sahil
Enter fullscreen mode Exit fullscreen mode

πŸ”„ Remember:

  • No spaces around = when assigning.
  • Use $variable_name to access the value.

This is also where quote types matter! πŸ‘‡


πŸ”Ή 4. Types of Quotes in Linux

πŸ”Έ Single Quotes ' '

Treat everything literally.

echo 'Today is $DATE'  # Output: Today is $DATE
Enter fullscreen mode Exit fullscreen mode

πŸ”Έ Double Quotes " "

Expand variables.

echo "Today is $DATE"  # Output: Today is Thu Jul 17
Enter fullscreen mode Exit fullscreen mode

πŸ”Έ Backticks ` ` or $(...)

Used for command substitution β€” execute commands inside strings.

echo "Today is $(date)"  # Output: Today is Thu Jul 17 ...
Enter fullscreen mode Exit fullscreen mode
echo "Today's date is: `date`"
Today's date is: Thursday 17 July 2025 09:52:35 AM IST
Enter fullscreen mode Exit fullscreen mode

We generally use "$()" in most cases in-order to avoid conflicts.


πŸ”Ή 5. Common Issues πŸ˜΅β€πŸ’«

Issue Cause Fix
command not found Typo or missing software Check spelling or install the package
Permission denied File not executable Use chmod +x file.sh or sudo
Script doesn’t run Wrong shebang or no permissions Add #!/bin/bash and make it executable
$PATH issues Custom scripts not working Add path to .bashrc: export PATH=$PATH:/my/scripts

🎯 Final Thoughts

Linux is powerful, but the magic often lies in the little things. Mastering aliases, variables, and quote types can take your terminal game from β€œmeh” to β€œmaster”. 😎

Got feedback or other tips? Drop them below! πŸ‘‡πŸ’¬

Happy terminaling! πŸ–₯οΈπŸ§πŸ’™

Top comments (0)