You are currently viewing Intermediate Linux Terminal Commands
Linux terminal by Lukas

Intermediate Linux Terminal Commands

Linux logo

Welcome to our guide on intermediate Linux terminal commands! If you’ve got the basics down, you’re ready to take the next step. Here, we’ll explore handy tools for files, users, and more.

Linux Text Editing Tools

Ready to get better with Linux text editing tools? These commands make editing files a breeze:

  • nano: A simple choice for quick edits. For example, type nano /etc/hosts.
  • vim or vi: A solid editor for tweaks. Start with vim script.sh, then press i.
  • emacs: A flexible option among Linux text editing tools. Use emacs config.conf & to run it.
Screenshot of vim editor in Linux
Vim in action with a script file.

Pro Tip: Try vim shortcuts like hjkl to speed up your work with these tools!

Linux File Permissions Basics

Want to learn Linux file permissions basics? Here’s how these commands help you control access:

  • chmod: Change access easily. For instance, chmod -R u+x scripts/ makes files runnable.
  • chown: Set a file’s owner. Try chown user1 file.txt as part of Linux file permissions basics.
  • chgrp: Switch group access. Use chgrp developers project/.

Also, try chmod 755 file.sh for quick permission setups.

Screenshot of ls -l showing file permissions
File permissions after running chmod 755.

Monitor Linux Processes

Need to monitor Linux processes? These tools keep you on top of what’s running:

  • ps: See active processes. Type ps aux for details.
  • top or htop: Watch live stats. Run htop to monitor Linux processes clearly.
  • kill: Stop a process. For example, kill -9 1234 ends it fast.
Screenshot of htop showing process management
Monitoring processes with htop.

Tip: Use ps aux | grep name for quick process checks.

Package Management with Intermediate Commands

Updating your system? Here’s what to use for package handling:

Debian/Ubuntu

  • apt-get: Add software. Try sudo apt-get install nginx.
  • dpkg: Handle .deb files. Use dpkg -i package.deb.

Red Hat/Fedora

  • yum: Install packages. Run sudo yum install httpd.
  • rpm: Use .rpm files. Type rpm -ivh package.rpm.

Pro Tip: Refresh Debian with apt-get update && apt-get upgrade.

File Searching Commands

Need to find files fast? Try these search tools:

  • find: Search by name. Try find / -name "*.log".
  • locate: Quick searches. Run locate config.conf after sudo updatedb.

Text Manipulation Tools

Working with text? These commands are great for the job:

  • grep: Find patterns. For example, grep -r "error" /var/log/.
  • sed: Edit text fast. Use sed 's/old/new/g' file.txt.
  • awk: Pull out data. Try awk '{print $1}' file.txt.

Combo: cat access.log | grep "404" | awk '{print $7}' grabs 404 links.

Archiving and Compression

Packing files? Check out these compression tools:

  • tar: Group files. Use tar -cvf archive.tar dir/.
  • gzip: Shrink files. Run gzip file.txt.
  • zip/unzip: Make .zip files. Try zip archive.zip *.txt.

One-Liner: tar -czvf archive.tar.gz dir/ does both.

Linux Network Troubleshooting

Need help with Linux network troubleshooting? These commands get you connected:

  • ip: Check network info. Type ip addr show.
  • ping: Test a connection. Use ping -c 10 google.com.
  • ssh: Log in remotely with Linux network troubleshooting. Try ssh user@192.168.1.10.
  • scp: Move files securely. Run scp file.txt user@remote:/path/.
Screenshot of ip addr show for networking
Network details from ip addr show.

Linux User Account Setup

Starting with Linux user account setup? These commands make it simple:

  • useradd: Add a user. Use sudo useradd -m -s /bin/bash obiwan.
  • passwd: Set a password. Try sudo passwd obiwan.
  • usermod: Update a user with Linux user account setup. For example, sudo usermod -aG sudo obiwan.
  • userdel: Remove a user. Run sudo userdel -r obiwan.
Screenshot of user management with cat /etc/passwd
User list after adding obiwan.

Group Management

Sorting users into groups? Here’s how to do it:

  • groupadd: Make a group. Use sudo groupadd jedi.
  • gpasswd: Add users to groups. Try sudo gpasswd -a obiwan jedi.
  • groups: See user groups. Run groups obiwan.

Password Policies

Keeping accounts secure with Linux user account setup? Try this:

  • chage: Set password rules. For instance, sudo chage -M 60 obiwan.

File Transfer Commands

Moving files around? Give these a go:

  • wget: Grab files online. Use wget https://example.com/file.zip.
  • curl: Download stuff. Run curl -O https://example.com/file.txt.
  • rsync: Sync files. Try rsync -av dir/ remote:/backup/.

System Information

Curious about your system? Check these out:

  • uname: See system details. Use uname -a.
  • df: Check disk space. Run df -h.
  • free: View memory. Try free -m.

More Useful Tricks

Want to boost your skills? For example:

  • rm -r dir1: Delete a folder and its contents.
  • cat file1 file2 > file3: Mix two files into one.
  • grep -n "word" file1: Find words with line numbers.
  • whoami: See your username.

Power Move: Chain commands like ls | grep "file" | sort.

Screenshot of chained commands in Linux
Output of ls | grep "file" | sort.

Great Job!

If you made it to the end and you understand everything, we have covered today then you’re fast becoming a Linux master, well done!

If you want to keep up to date with our latest posts, or you just want to say hi, why not follow us on Twitter/X

If you want to show your support, why not browse through our Products page and see if there is anything you need. Meganano receives a small profit from each sale made via our affiliate links.

Luke Barber

Hey there! I’m Luke, a tech enthusiast simplifying Arduino, Python, Linux, and Ethical Hacking for beginners. With creds like CompTIA A+, Sec+, and CEH, I’m here to share my coding and tinkering adventures. Join me on Meganano for easy guides and a fun dive into tech, no genius required!