History history lists recent commands ltnumbergt redoes that command ltpartialgt redoes the most recent command that started with ltpartial gt letters Globbing Describe to the shell not OS sets of file names with patterns ID: 532463
Download Presentation The PPT/PDF document "l ess typing" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
less typing
History
history
lists recent commands
.
!
<number>
redoes that command
!<partial>
redoes the most recent command that started with
<partial
>
letters
Globbing
Describe to the shell (not OS) sets of file names with patterns
~
means the home directory
?
means any character
*
means any string (including empty)
[<letters>]
means any one of the <letters> (except ...), which can also be a range
^
negates some glob expressions
File
name completion
Many
shells
provide
file name
completion: Use
tab
key to
expand partial file namesSlide2
locate a file
l
ocate
unix_class_files.zip locate unix_class
locate the path for file unix_class_files.zip
l
ocate the path for all the files containing
unix_classSlide3
grouping & compressing files
t
ar –
cz
vf
file.tar.gz
file1 file2
tar
–
xzvf file.tar.gz
groups and compresses files
ungroups and decompresses
file.tar.gzSlide4
grouping & compressing files
g
zip
file1zip file.zip f1 f2unzip
file.zipgunzip file.gz
compresses
file1
into
file.gz
compresses
f1 and f2 into file.zip
decompresses file.zip
decompresses
file.gzSlide5
Text handling commandsSlide6
cat, less
cat file1
displays
file1 as a whole
less file1
displays
file1
page-by-page
allows scrolling through the file
< or g
goes to the beginning> or G goes to the endspace page down
b
page up
/pattern
search pattern
n
find next one
N
find previous
q
quit
cat file1 file2 file3
c
oncatenates and displays
file1
,
file2
and file3 as a whole
cat file1 file2 file3 > out.txt
concatenates file1, file2 and file3 and redirects output to file out.txt
cat file4 file5 >> out.txt
concatenates file4 and file5 and appends output to file out.txtSlide7
head, tail
head file1
d
isplays the first 10 lines of file1
head –n 20 file1
d
isplays the first 20 lines of
file1
tail file1
d
isplays the last 10 lines of file1
tail –n 20 file1
d
isplays the last 20 lines of
file1Slide8
regular expressions - grep
Regular expressions
describe
sets of strings with patterns (not the same as globbing)A normal character matches
itself. matches any normal characterA range
[<letters>]
matches any one of the
<letters
>,
which
can also be a range [^<letters>] matches any not one of the <letters>? after a pattern makes it optional+
after a pattern matches one or more repetitions* after a pattern matches any number of repetitions
{
<N>}
after a pattern matches
<N>
repetitions in
regular expressions
^
means the start of the
line
$
means the end of the
line
(
)
s round a
regular expression makes
it one thing to which repetition and placement options can be applied.
grep finds lines in files that match limited regular expressions.grep ‘^>’
file.txt
displays lines in file.txt that start with a >grep -c ‘^+$’ *fastq
displays lines in all fasta files that are composed of a single
+