Cutting-edge tech Move all files ending with .txt to a USB drive $ m v * . t x t / m e d i a / U S B Replace "human" with "H. sapiens" in all files in the current directory $ l s | x a r g s s e d - i ' s / h u m a n / H . s a p i e n s / g ' Create a file containing 100 lines of random numbers $ f o r i i n ` s e q 1 1 0 0 ` ; d o e c h o $ R A N D O M > > o u t . t x t ; d o n e Show the last 50 executed commands $ h i s t o r y | t a i l - n 5 0
m k d < T A B > man pages provide documentation $ m a n m k d i r "--help" or "-h" flags shows the quick reference $ m k d i r - - h e l p makes it even easier explainshell.com
s e @ r n a s e q 2 0 1 4 : ~ $ Directory contents . ├ ─ ─ D e s k t o p ├ ─ ─ D o c u m e n t s ├ ─ ─ D o w n l o a d s ├ ─ ─ l i b ├ ─ ─ M u s i c ├ ─ ─ P i c t u r e s ├ ─ ─ P u b l i c ├ ─ ─ T e m p l a t e s └ ─ ─ V i d e o s 9 d i r e c t o r i e s , 0 f i l e s
s e @ r n a s e q 2 0 1 4 : ~ $ l s Output D e s k t o p D o c u m e n t s D o w n l o a d s M u s i c P i c t u r e s P u b l i c T e m p l a t e s V i d e o s Directory contents . ├ ─ ─ D e s k t o p ├ ─ ─ D o c u m e n t s ├ ─ ─ D o w n l o a d s ├ ─ ─ l i b ├ ─ ─ M u s i c ├ ─ ─ P i c t u r e s ├ ─ ─ P u b l i c ├ ─ ─ T e m p l a t e s └ ─ ─ V i d e o s 9 d i r e c t o r i e s , 0 f i l e s
p w d Output / h o m e / c o u r s e Directory contents . ├ ─ ─ D e s k t o p ├ ─ ─ D o c u m e n t s ├ ─ ─ D o w n l o a d s ├ ─ ─ l i b ├ ─ ─ M u s i c ├ ─ ─ P i c t u r e s ├ ─ ─ P u b l i c ├ ─ ─ T e m p l a t e s └ ─ ─ V i d e o s 9 d i r e c t o r i e s , 0 f i l e s
D e s k t o p / d a y _ 0 1 / c l i $ p w d Output / h o m e / c o u r s e / D e s k t o p / d a y _ 0 1 / c l i Directory contents . 0 d i r e c t o r i e s , 0 f i l e s
to the screen You can redirect this stream into a file instead Redirects can overwrite or append to the file Prompt $ e c h o " I k n o w m y A T G C s " > m y _ f i r s t _ f i l e . t x t $ e c h o " H e l l o a g a i n " > > m y _ f i r s t _ f i l e . t x t Output Directory contents . └ ─ ─ m y _ f i r s t _ f i l e . t x t 0 d i r e c t o r i e s , 1 f i l e
Prompt $ c a t m y _ f i r s t _ f i l e . t x t Output I k n o w m y A T G C s H e l l o a g a i n Directory contents . └ ─ ─ m y _ f i r s t _ f i l e . t x t 0 d i r e c t o r i e s , 1 f i l e
l e s s m y _ f i r s t _ f i l e . t x t Output Session I k n o w m y A T G C s H e l l o a g a i n m y _ f i r s t _ f i l e . t x t ( E N D ) Directory contents . └ ─ ─ m y _ f i r s t _ f i l e . t x t 0 d i r e c t o r i e s , 1 f i l e
m o v e d . t x t c o p i e d . t x t Output Directory contents . ├ ─ ─ c o p i e d . t x t └ ─ ─ m o v e d . t x t 0 d i r e c t o r i e s , 2 f i l e s
can execute. These are called executable files, which can be human- readable text file (scripts) or a compiled program (binaries). Executing a bash script $ b a s h m y _ s c r i p t . s h Executing a compiled binary $ s i c k l e s e - f i n p u t . f a s t q - o o u t p u t . f a s t q