UNIX command line - PowerPoint PPT Presentation

1 / 26
About This Presentation
Title:

UNIX command line

Description:

UNIX command line – PowerPoint PPT presentation

Number of Views:144
Avg rating:3.0/5.0
Slides: 27
Provided by: 93948
Category:
Tags: unix | command | line | theory | waiting

less

Transcript and Presenter's Notes

Title: UNIX command line


1
UNIX command line
2
In this module you will learn
  • What is the computer shell
  • What is the command line interface
  • What is the directory tree
  • Some UNIX commands

3
The Shell
The shell is a program that provides an interface
to the operating system
graphical shell
command-line shell
graphical interface
command-line interface
4
graphical interface
5
What happens when you double click on the icon of
an application?
6
What happens when you double click on the icon of
an application?
7
command-line interface
prompt
Here you write the command
8
Open a command-line terminal on your computer
9
You can type the application name ( options) in
the command-line terminal screen and then type
Return
command
10
The directory structure
The file-system is arranged in a hierarchical
structure, like an inverted tree
The top of the hierarchy is traditionally called
root
When you first login, your current working
directory is your home directory
11
  • Access you home directory using the command-line
    interface
  • Start the gedit text editor
  • Create a text file myfile.txt and save it in
    your home directory
  • Go to the command-line interface and type ls at
    the prompt

12
About UNIX
Everything in Unix is either a file or a process
A process is an executing program identified by a
unique PID (PID Process IDentifier)
A file is a collection of data
13
About Unix commands
Commands are themselves programs
rm myfile.txt Return
The shell searches the file containing the
program rm executes the program rm on
myfile.txt After the process rm myfile.txt has
finished running, the shell returns the prompt
to you, indicating that it is waiting for
further commands.
Here you can type a new command
14
General remarks
If you've made a typo CTRL-u to cancel the
whole line
Unix is case-sensitive
There are commands that can take options
The options change the behaviour of the command
UNIX uses command-line completion
15
General remarks
command_name -options ltfilegt Return
man ltcommand namegt Enter
whatis ltcommand namegt Enter
16
General remarks
CTRL-A sets the cursor at the beginning of the
line
CTRL-E sets the cursor at the end of the line
You can use up and down arrows to recall
commands
The command whereis tells you where is a given
program
You can use a text editor to write stuff
17
Listing files and directories
The directories ., .., and
ls -a Enter
cd . Enter
cd .. Enter
ls /oeiras
18
Handling files and directories
clear
less
more
19
Redirection
20
File system security (access rights)
Each file (and directory) has associated access
rights, which may be found by typing ls -l
size in bytes
permissions
owner
-rwxr-xr-- 1 gould admin 2541 2009-08-19
1657 new_scop.txt
d
file's name
number of links
group owner
date and time of the last modification
Access rights on directories
r allows users to list files in the directory w
allows users to delete files from the directory
or move files into it x allow users to access
files in the directory
21
Changing access rights chmod
chmod go-rwx myfile.txt chmod arw biglist
22
Running your program from the command line
pymol
python test.py
chmod ax test.py test.py
BUT !/usr/bin/python
23
Processes and Jobs
A process may be in the foreground, in the
background, or be suspended
Backgrounding a long process has the effect that
the Unix prompt is returned immediately, and
other tasks can be carried out while the original
process continues executing
Running background processes
sleep 10 Enter
Backgrounding a current foreground process
sleep 100 Ctrl Z (Z shortcut) bg
Listing processes
ps list of processes with their associated
PID and status jobs list of running
processes fg jobnumber restart (foreground)
suspended process fg restart(foreground)
the last suspended process
24
UNIX Variables
Variables are a way of passing information from
the shell to programs when you run them
Some are set by the system, others by you, yet
others by the shell, or any program that loads
another program
shell variables apply only to the current
instance of the shell and are used to set
short-term working conditions
environment variables have a farther reaching
significance, and those set at login are valid
for the duration of the session.
echo OSTYPE
25
Setting the path
When you type a command, your path (or PATH)
variable defines in which directories the shell
will look to find the command you typed. If the
system returns a message saying "command Command
not found", this indicates that either the
command doesn't exist at all on the system or it
is simply not in your path.
setenv PATH PATH/Applications/Blast
set path (path /Applications/blast/)
To add this path PERMANENTLY, add the line to
your .cshrc AFTER the list of other commands
26
Transferring files between and connecting to
remote hosts
ssh user_at_host Password
scp ltSourceFilegt ltuser_at_hostdirectory/TargetFile
gt
sftp ltuser_at_hostgt password cd ltdirectorygt
get TargetFile put SourceFile
scp ltuser_at_host/directory/SourceFilegt
ltTargetFilegt
wget option... URL... URL
http//hostport/directory/file ftp//hostpo
rt/directory/file
Write a Comment
User Comments (0)
About PowerShow.com