0% found this document useful (0 votes)
109 views1 page

Cas - Command Line Basics

The command line basics document discusses the shell, which provides a text interface to Linux and listens for user input. It covers common Linux shells like bash, zsh, and csh. Bash is the default shell on most distributions. Commands, options, arguments, variables, globbing, and quoting are explained. Examples demonstrate listing directories with ls, viewing file contents with cat, setting and displaying variables, and using wildcards and environment variables like PATH.

Uploaded by

Katarina Cubrilo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views1 page

Cas - Command Line Basics

The command line basics document discusses the shell, which provides a text interface to Linux and listens for user input. It covers common Linux shells like bash, zsh, and csh. Bash is the default shell on most distributions. Commands, options, arguments, variables, globbing, and quoting are explained. Examples demonstrate listing directories with ls, viewing file contents with cat, setting and displaying variables, and using wildcards and environment variables like PATH.

Uploaded by

Katarina Cubrilo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Command Line Basics

- What is shell?
- The program providing the traditional text interface to the Linux system (command
interpreter)
- Listens to what user types. It is intermediary between user and Linux system
- Command interpreter
- Type of Linux shells: bash (Bourne again shell), zsh, csh, tzsh
- Bash is default shell on most Liux distributions
- We need only terminal Window
- commands, options and arguments, globbing, quoting, variables (and PATH variable)
- ls - list contents of folder
- prompt: nebojsa@srv1: ~/Documents$ - nebojsa is user, srv1 is host name (name of
linux machine), Documents$ (current folder)
- ls -l - format results a little bit differently, and gives are more informations.
l is long listing
- ls -l /home/nebojsa - we can sepcify path for listing. If no path is specified,
ls lists current directory
- In GUI (desktop environment), we would use windows!
- cat file1.txt (short for concatenate). Command cat displays the contents of a
file. In this case file1
- cat file1.txt file2.txt (we can show contents of more than one file in one
command)
- echo Hello - echo is used just to put output on screen.
- echo Hello There - echo shows arguments on console. In this case, no more than
one white space will be displayed
- Here quoting comes into place echo "Hello There" (with quotes, echo sees
only one argument)
VARIABLES
- a=Hello (we assigned value Hello to variable a)
- echo $a (we display the contents of variable a)
- a=Hello There - we see error, because a can take only one value!
- a="Hello There" * now is ok
- b="Hello Buddy"
- echo $a $b
- echo "$a$b" - it works. It treats as one argument, both $a and $b
- variable as in programming stores something
GLOBBING
- ls *.txt - show me everything that ends with txt, asterix says any character (0
or more)
- ls file?.txt - question mark is any single character
- ls * - shows everything in directory
ENVIRONMENT VARIABLES
-special type of variables
-for example path
-echo $PATH - shows us a bunch of different directories (similar concept in
windows)
- PATH tells the shell where to look for specific commands
- which ls - search for ls command and shows where binary ls lives (where it is)
- if there are any executive files in any of the folders in $PATH variable, they
can be executed from whatever folder
- ls; ls - runs ls command twice. We can in one command line put more commands
separated with ;
- echo $a;echo $b; - we will show variable contents in two separate lines, we run
two different commands
- history - gives us all commands we typed

You might also like