| MAN page
                        
                                                                                    
                                                                                            | man -a useradd | useradd command in all sections |  
                                                                                            | man -k passwd | grep 8 | searching passwd keyword in man page from section 8 |  
                                                                                            | man 8 useradd | showing useradd command from section 8 |  
                                                                                            | man man | showing man command help |  Hard links, soft links, finding files
                        
                                                                                    
                                                                                            | ln /etc/hosts myhosts | create hard links myhosts to /etc/hosts |  
                                                                                            | ln -s /etc/hosts/ myhosts | create symbolic links myhosts |  
                                                                                            | find /etc -name hosts | Find in /etc files with exact name "hosts" |  
                                                                                            | find /etc -name "hosts" | Find in /etc files with "hosts" in its name |  
                                                                                            | find /etc -name "hosts" -exec cp {} /etc/test/ \; | Find in /etc file with "hosts" in name and copy it to /etc/test |  
                                                                                            | find /etc -size +100K 2>/dev/null | File in /etc files over 100Kb and send error to /dev/null |  
                                                                                            | grep student /etc/* 2>/dev/null | Find in /etc files with "student" in content |  
                                                                                            | grep -l student /etc/* 2>/dev/null | List only the directories |  
                                                                                            | find /etc -exec grep -l student {} \; 2>/dev/null; cp {} /find/contents/ \; 2>/dev/null | Find all directories and sub with files containing student in content and copy the result to /find/content |  Administrative Tasks
                        
                                                                                    
                                                                                            | visudo | Edit sudo configuration file |  
                                                                                            | chvt t | Change virtual terminal 5 |  
                                                                                            | /etc/securetty | Secure console file, delete 1 will no longer have access to that console |  |  | Input Output Redirection
                        
                                                                                    
                                                                                            | > | overwrite |  
                                                                                            | < | send into command |  
                                                                                            | >> | append |  
                                                                                            | << | append into command or file |  
                                                                                            | 2> /dev/null | redirect error to null file |  Text Processing Utilities
                        
                                                                                    
                                                                                            | cut -d : -f 3 /etc/passwd | Display third column using ":" delimiter in /etc/passwd |  
                                                                                            | cut -d : -f 1 /etc/passwd | sort | tr [:lowercase:] [:uppercase:] | Display all username in /etc/passwd and translate all lowercase to uppercase |  
                                                                                            | awk -F : ' { print $1 } ' /etc/passwd | Display first column using ":" field delimiter (-F) |  
                                                                                            | sed -i -e '10d' grepfile1 | Delete (10d) interactively (-i) using edit option(-e) the tenth line |  Archive, Backup, Compress, Uncompress
                        
                                                                                    
                                                                                            | tar cvf name.tar /dir | Create name.tar file from /dir |  
                                                                                            | tar -xvfz archive.tar.gzip -C /target/dir | Extract archive.tar.gzip to /tar/dir |  |  | Create, Delete, Copy, Move
                        
                                                                                    
                                                                                            | ls -al /etc | list all files (-a) with all info (-l) in /etc |  
                                                                                            | ls -r | list sub-directories (-r) |  
                                                                                            | cp -R /etc/hosts ~/files/ | copy all (-R) in hosts to home/files/ |  
                                                                                            | mkdir -p /etc/photos | make directory etc and sub-directory photos |  
                                                                                            | mv /tmp/test ~ | move test to home directory |  
                                                                                            | rm -rf | remove recursively and ignore non existent file |  head, tail,
                        
                                                                                    
                                                                                            | head -n 5 /etc/passwd | Display first 5 lines in /etc/passwd |  
                                                                                            | tail -f /var/log/messages | Display the recent system messages |  Regular expressions
                        
                                                                                    
                                                                                            | note | Use with sed, vim, awk, grep |  
                                                                                            | ^ | Start of a string | ^abc | abc, abcdef,abc123 |  
                                                                                            | $ | End of a string | abc$ | abc,123abc,fdeabc |  
                                                                                            | | | Alteration | 1|8 | 1,8 |  
                                                                                            | {...} | Exact quanity | ab{2}c | abbc |  
                                                                                            | [...] | Explicit set of character to match | a[bB]c | abc,aBc |  
                                                                                            | * | Null or more of the preceding character | ab*c | ac,abc,abbbbc |  
                                                                                            | (...) | Group of character | (123){3} | 123123123 |  
                                                                                            | + | One or more of predceding character | ab+c | abc,abbbbc |  
                                                                                            | ? | Null or 1 of the preceding character | ab?c | abc, ac |  
                                                                                            | . | Any single character |  
                                                                                            | \s | Whitespaces | .* | Zero or more of any character |  | 
            
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by nhatlong0605