5

I am reading The Linux Command Line: A Complete Introduction to learn about the command line. The book is great. However, there is a major problem for me: It does not have exercises/projects at the end of each chapter to let the material sink in.

Most programming books I have read so far had exercises/projects at the end of each chapter to let the material sink in. I have searched the internet for "command line exercises" and similar queries but not much came up.

I read that the best practice is to actually make use of the command line by making it do a task of your own. However currently, I really can't think of a useful task to use the command line.

So how should I practice to let the material sink in? Or, should I use a book that teaches a Unix shell with end-of-chapter exercises?

P.S: I am pretty sure that I can find a lot of shell scripting exercises. But currently, I am on chapter 7 and shell scripting starts at chapter 24. So right now, I need exercises to do directly on the terminal.

closed as primarily opinion-based by jasonwryan, muru, Anthon, don_crissti, chaos Oct 9 '15 at 6:39

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Think of activities you do regularly, and automate them. Check a site at a given time each day? Automate it. – muru Oct 8 '15 at 18:16
  • @muru Thanks but that's shell scripting right? Right now, I think I need exercises to do on the terminal. – Utku Oct 8 '15 at 18:18
  • Well, a big step in writing scripts is testing out the commands on a terminal. :D – muru Oct 8 '15 at 18:19
  • Shell scripting is largely just saving your commands to a file so they can be executed again without typing them all out. Most anything you'd put into a shell script you can also do from the command line. – Bratchley Oct 8 '15 at 18:20
  • 1
    Yes, refining things down to the point where they're functioning programmatically is the best practice. – Bratchley Oct 8 '15 at 18:25
5

Practice doing the things you are already doing. Next time you go to open a graphical file manager (nautilus, dolphin, etc) open a terminal instead and perform your tasks there. As you say, the best way to learn is to practice and the best things to practice are the things you need to do anyway. Pretty much everything you can do within whatever GUI you use can be done from a terminal with the command line. Next time you open any GUI program, think about how you can accomplish that task with the command line and do it there instead(e.g. installing a package or updating your system, opening a file for editing/display, managing files, etc).

5

In my opinion, the best way to "practice" the command line is to live in the command line. By that I mean a virtual terminal (press Ctrl-F2), or even disabling the GUI by default (edit /etc/inittab to change the default runlevel to 3.)

The author of that book you are reading even states: "This book is a broad overview of 'living' on the Linux command line."

I really can't think of a useful task to use the command line.

What this means to me is simply that you know how to do things without the command line, so you aren't forced to learn the (text-only) command line methods for doing those things.

If you start "living" in the command line, you will start learning the system from the bottom up, the way the computer actually "sees" the world.

Rather than picking some specialized existing functionality that you can already do perfectly well with a GUI, and that is quite complicated through the command line (e.g., listening to music samples on Amazon)—just sit in front of a virtual terminal and find out what there is there that you can do. Then get more familiar with that and do it better and faster.

Some examples of very simple routine tasks on the command line:

  • Find out what time it is.
  • Trickier: Edit your .bash_profile to display what time it is in each command prompt.
  • Find out what is in a directory.
  • Find out what is on the flash drive you just found in your drawer.
  • Download a file that you have the URL for.
  • Jot down some notes (in a text file).
  • Search for a file.
  • Install some new software.
  • Make a new user for your system.
  • Find out if your network connection is working.
  • Set a reminder for yourself.
  • Print a document.
  • Reformat an external hard drive.
  • Check what programs exist to do something you want to try (e.g. man -k printer)

Many of these might seem silly to do in the command line if you are using a GUI. If you use a GUI when you're trying to learn the command line, you end up "spoiled".

There are only two activities for which a GUI is absolutely necessary: Looking at pictures, and watching videos. Everything else can be done through the command line.

  • 1
    Good list. Especially, "jot down some notes". As you are learning about the command line (Shotts's book is excellent for that), take notes about what you're learning. You'll learn how to use a text editor, how to start the text editor (from the command line). Then you'll get tired of typing gedit ~/mynotes and learn how to create an alias. Then you'll learn how to create a simple script instead of an alias, where to put it, how to make it executable and in your PATH, etc, etc. That's what Wildcard means by live on the command line. – jrw32982 Aug 28 '18 at 21:04
  • @jrw32982, yep, that's what I mean. :) (Don't forget to vote when you find info useful.) – Wildcard Aug 28 '18 at 21:12
2

This site lists tens of thousands of problems along the lines of "How do I do X in Unix & Linux?"

:-)

  • 1
    I was about to flag this as VLQ until I opened the link :-) – Firelord Oct 9 '15 at 14:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.