Command Line Usage

Description

This page describes how to interact with the command line

In particular it addresses basic commands in the bash shell

Welcome to Earth!

You just opened a terminal in you favorite Linux distribution. A black window is facing you and a blinking cursor is prompting you for typing a command.

Here are the first commands that you may want to try:

  • clear
  • date
  • echo
  • info
  • ls
  • pwd
  • who
  • whoami

Video 1

You can see the video of this example at:

Streams and Pipes

  • echo
  • cat
  • tac
  • rev
  • pipes

Video 2

You can see the video of this example at:

Creating Directories

  • mkdir
  • rmdir

The two commands above will create and remove directories in the file system.

Removing Files

The rm command will remove files and directories from the file system. You must Fear this command, or at least respect it.

  • rm
  • rm -r

The -r option of the rm command is particularly dangerous. It removes the content of a directory and all its subdirectories. Normally there is not a way of undoing this delete. Therefore, you must verify your current location in the file system before you use this command. Of course, you also want to verify that you really want to delete that directory and its content.

Our conscience is now clear, whatever happens to you, remember that we told you so !

Video 3

You can see the video of this example at:

Copying, Moving, Deleting files

  • cp
  • mv
  • rm

along with their recursive options, that must be used very carefully since they can be dangerous

  • cp -r
  • rm -r

Video 4

You can see the video of this example at:

Moving Through Directories

  • pushcd
  • popd

Listing Files

  • ls

Counting Chars, Words, Lines

  • wc

Root Superpowers

  • sudo

Make me a sandwich

Environment Variables

  • export
  • echo
  • env

Sorting

  • sort

Help Me!

  • man
  • info