Skip to content

noahgift/shell-pipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

shell-pipes

-7-70 IPES

Examples

Pipeline

ls -l /usr/bin | wc -l 
ls -l /usr/bin | wc -l > out.txt

Conditional

ls -l /wrongpath && touch newfile.txt 
ls -l /usr/bin && touch newfile.txt

Process files with Pipelines

STR=$'1. This is a line\n2. This is a line\n3. This is a line.'
echo "$STR"
echo "$STR" > lines.txt
cat lines.txt | sort -r | less
cat lines.txt | grep 3

Append to a file

echo "something\n" > append.txt
wc -l append.txt
echo "another thing >> append.txt
wc -l append.txt

Throw away stderr

ls -l /wrong/path 2> /dev/null

Reading file parts

tail -f tail -f /var/log/dpkg.log
head -n 2 tail -f /var/log/dpkg.log
tail -n 2 tail -f /var/log/dpkg.log

Using History

history | less
history | grep tail
!1
!!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published