Cheatography
                https://cheatography.com
            
        
        
    
                   
                            
    
                    A collection of usefull commands
                    
                 
                    
        
        
            
    
        
                            
        
                
        
            
                                
            
                
                                                
                                
    
    
            Bash Variables
        
                        
                                                                                    
                                                                                            Commands  | 
                                                                                                                        Description  | 
                                                                                 
                                                                                            
                                                                                            env  | 
                                                                                                                        Shows environment variables  | 
                                                                                 
                                                                                            
                                                                                            $PATH  | 
                                                                                                                        Search Path  | 
                                                                                 
                                                                                            
                                                                                            $SHELL  | 
                                                                                                                        Displays current shell  | 
                                                                                 
                                                                                            
                                                                                            $HOME  | 
                                                                                                                        Displays Home Directory  | 
                                                                                 
                                                                                            
                                                                                            echo $NAME  | 
                                                                                                                        outputs the value of a variable  | 
                                                                                 
                                                                         
                             
    
    
            File Commands (Options)
        
                        
                                                                                    
                                                                                            -a  | 
                                                                                                                        show hidden files  | 
                                                                                 
                                                                                            
                                                                                            -A  | 
                                                                                                                        show hidden except..  | 
                                                                                 
                                                                                            
                                                                                            -d  | 
                                                                                                                        only show directories  | 
                                                                                 
                                                                                            
                                                                                            -h  | 
                                                                                                                        human readable size  | 
                                                                                 
                                                                                            
                                                                                            -i  | 
                                                                                                                        inode info  | 
                                                                                 
                                                                                            
                                                                                            -l  | 
                                                                                                                        long list  | 
                                                                                 
                                                                                            
                                                                                            -m  | 
                                                                                                                        output as csv  | 
                                                                                 
                                                                                            
                                                                                            -r  | 
                                                                                                                        sort in reverse order  | 
                                                                                 
                                                                                            
                                                                                            -S  | 
                                                                                                                        sort by file size  | 
                                                                                 
                                                                         
                             
    
    
            Bash Shortcuts
        
                        
                                                                                    
                                                                                            CTRL-c  | 
                                                                                                                        stop current execution  | 
                                                                                 
                                                                                            
                                                                                            CTRL-z  | 
                                                                                                                        sleep  | 
                                                                                 
                                                                                            
                                                                                            CTRL-a  | 
                                                                                                                        start of line  | 
                                                                                 
                                                                                            
                                                                                            CTRL-e  | 
                                                                                                                        end of line  | 
                                                                                 
                                                                                            
                                                                                            CTRL-r  | 
                                                                                                                        search history  | 
                                                                                 
                                                                                            
                                                                                            !!  | 
                                                                                                                        repeat last command  | 
                                                                                 
                                                                                            
                                                                                            ALT-.  | 
                                                                                                                        last argument of last command  | 
                                                                                 
                                                                         
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            Directory Commands
        
                        
                                                                                    
                                                                                            pwd  | 
                                                                                                                        show current directory  | 
                                                                                 
                                                                                            
                                                                                            mkdir  | 
                                                                                                                        makes directory  | 
                                                                                 
                                                                                            
                                                                                            cd dir  | 
                                                                                                                        goes to directory  | 
                                                                                 
                                                                                            
                                                                                            cd  | 
                                                                                                                        goes up a directory  | 
                                                                                 
                                                                                            
                                                                                            ls  | 
                                                                                                                        list files  | 
                                                                                 
                                                                                            
                                                                                            touch  | 
                                                                                                                        creates or updates file  | 
                                                                                 
                                                                                            
                                                                                            cat  | 
                                                                                                                        places standard input into file  | 
                                                                                 
                                                                                            
                                                                                            tail  | 
                                                                                                                        outputs last 10 lines of file  | 
                                                                                 
                                                                                            
                                                                                            rm  | 
                                                                                                                        removes file  | 
                                                                                 
                                                                         
                             
    
    
            List options
        
                        
                                                                                    
                                                                                            -R  | 
                                                                                                                        recursive list  | 
                                                                                 
                                                                                            
                                                                                            -a  | 
                                                                                                                        show all  | 
                                                                                 
                                                                                            
                                                                                            -r  | 
                                                                                                                        reverse order  | 
                                                                                 
                                                                                            
                                                                                            -t  | 
                                                                                                                        sort by last modified  | 
                                                                                 
                                                                                            
                                                                                            -1  | 
                                                                                                                        one file per line  | 
                                                                                 
                                                                         
                             
    
    
            File Search
        
                        
                                                                                    
                                                                                            grep -i  | 
                                                                                                                        Case insensitive search  | 
                                                                                 
                                                                                            
                                                                                            grep -r  | 
                                                                                                                        recursive search  | 
                                                                                 
                                                                                            
                                                                                            grep -v  | 
                                                                                                                        inverted search  | 
                                                                                 
                                                                                            
                                                                                            grep -o  | 
                                                                                                                        show matched part of file only  | 
                                                                                 
                                                                                            
                                                                                            whereis 'command'  | 
                                                                                                                        find source of command  | 
                                                                                 
                                                                                            
                                                                                            locate 'file'  | 
                                                                                                                        locate a file  | 
                                                                                 
                                                                         
                             
    
                             | 
                                                                              | 
                                                        
                                
    
    
            Terminal Shortcuts
        
                        
                                                                                    
                                                                                            screen  | 
                                                                                                                        starts screen session  | 
                                                                                 
                                                                                            
                                                                                            screen -r  | 
                                                                                                                        resumes screen session  | 
                                                                                 
                                                                                            
                                                                                            CTRL-A  | 
                                                                                                                        activates commands  | 
                                                                                 
                                                                                            
                                                                                            CTRL-A c  | 
                                                                                                                        creates new terminal  | 
                                                                                 
                                                                                            
                                                                                            CTRL-A n  | 
                                                                                                                        next terminal  | 
                                                                                 
                                                                                            
                                                                                            CTRL-A p  | 
                                                                                                                        previous terminal  | 
                                                                                 
                                                                                            
                                                                                            CTRL-A A  | 
                                                                                                                        rename terminal  | 
                                                                                 
                                                                         
                             
    
    
            Network
        
                        
                                                                                    
                                                                                            ping host  | 
                                                                                                                        pings host  | 
                                                                                 
                                                                                            
                                                                                            whois domain  | 
                                                                                                                        gets whois information for domain  | 
                                                                                 
                                                                                            
                                                                                            dig domain  | 
                                                                                                                        gets dns info  | 
                                                                                 
                                                                         
                             
    
    
            SSH
        
                        
                                                                                    
                                                                                            ssh user@host  | 
                                                                                                                        connects to host as user  | 
                                                                                 
                                                                                            
                                                                                            ssh -p port user@host  | 
                                                                                                                        connects to specific port to host as user  | 
                                                                                 
                                                                         
                             
    
    
            Shortcuts
        
                        
                                                                                    
                                                                                            Ctrl+C  | 
                                                                                                                        Halts command  | 
                                                                                 
                                                                                            
                                                                                            Ctrl+Z  | 
                                                                                                                        Stops current command  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + D  | 
                                                                                                                        Logs out  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + W  | 
                                                                                                                        erases one word in line  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + U  | 
                                                                                                                        erases line  | 
                                                                                 
                                                                                            
                                                                                            Ctrl + R  | 
                                                                                                                        most recent command  | 
                                                                                 
                                                                                            
                                                                                            exit  | 
                                                                                                                        logs out of session  | 
                                                                                 
                                                                         
                             
                             | 
                                                            
            
                            
            
            
        
        
        
        
        
            
    
        
          
        
         
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets