Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
389 lines (388 sloc) 10.9 KB
{
"sections": [
{
"title": "File System",
"commands": [
{
"command": "ls",
"description": "list items in current directory"
},
{
"command": "ls -l",
"description": "list items in current directory and show in long format to see perimissions, size, and modification date"
},
{
"command": "ls -a",
"description": "list all items in current directory, including hidden files"
},
{
"command": "ls -F",
"description": "list all items in current directory and show directories with a slash and executables with a star"
},
{
"command": "ls dir",
"description": "list all items in directory dir"
},
{
"command": "cd dir",
"description": "change directory to dir"
},
{
"command": "cd ..",
"description": "go up one directory"
},
{
"command": "cd /",
"description": "go to the root directory"
},
{
"command": "cd ~",
"description": "go to to your home directory"
},
{
"command": "cd -",
"description": "go to the last directory you were just in"
},
{
"command": "pwd",
"description": "show present working directory"
},
{
"command": "mkdir dir",
"description": "make directory dir"
},
{
"command": "rm file",
"description": "remove file"
},
{
"command": "rm -r dir",
"description": "remove directory dir recursively"
},
{
"command": "cp file1 file2",
"description": "copy file1 to file2"
},
{
"command": "cp -r dir1 dir2",
"description": "copy directory dir1 to dir2 recursively"
},
{
"command": "mv file1 file2",
"description": "move (rename) file1 to file2"
},
{
"command": "ln -s file link",
"description": "create symbolic link to file"
},
{
"command": "touch file",
"description": "create or update file"
},
{
"command": "cat file",
"description": "output the contents of file"
},
{
"command": "less file",
"description": "view file with page navigation"
},
{
"command": "head file",
"description": "output the first 10 lines of file"
},
{
"command": "tail file",
"description": "output the last 10 lines of file"
},
{
"command": "tail -f file",
"description": "output the contents of file as it grows, starting with the last 10 lines"
},
{
"command": "vim file",
"description": "edit file"
},
{
"command": "alias name 'command'",
"description": "create an alias for a command"
}
]
},
{
"title": "System",
"commands": [
{
"command": "shutdown",
"description": "shut down machine"
},
{
"command": "reboot",
"description": "restart machine"
},
{
"command": "date",
"description": "show the current date and time"
},
{
"command": "whoami",
"description": "who you are logged in as"
},
{
"command": "finger user",
"description": "display information about user"
},
{
"command": "man command",
"description": "show the manual for command"
},
{
"command": "df",
"description": "show disk usage"
},
{
"command": "du",
"description": "show directory space usage"
},
{
"command": "free",
"description": "show memory and swap usage"
},
{
"command": "whereis app",
"description": "show possible locations of app"
},
{
"command": "which app",
"description": "show which app will be run by default"
}
]
},
{
"title": "Process Management",
"commands": [
{
"command": "ps",
"description": "display your currently active processes"
},
{
"command": "top",
"description": "display all running processes"
},
{
"command": "kill pid",
"description": "kill process id pid"
},
{
"command": "kill -9 pid",
"description": "force kill process id pid"
}
]
},
{
"title": "Permissions",
"commands": [
{
"command": "ls -l",
"description": "list items in current directory and show permissions"
},
{
"command": "chmod ugo file",
"description": "change permissions of file to ugo - u is the user's permissions, g is the group's permissions, and o is everyone else's permissions. The values of u, g, and o can be any number between 0 and 7."
},
{
"command": 7,
"description": "full permissions"
},
{
"command": 6,
"description": "read and write only"
},
{
"command": 5,
"description": "read and execute only"
},
{
"command": 4,
"description": "read only"
},
{
"command": 3,
"description": "write and execute only"
},
{
"command": 2,
"description": "write only"
},
{
"command": 1,
"description": "execute only"
},
{
"command": 0,
"description": "no permissions"
},
{
"command": "chmod 600 file",
"description": "you can read and write - good for files"
},
{
"command": "chmod 700 file",
"description": "you can read, write, and execute - good for scripts"
},
{
"command": "chmod 644 file",
"description": "you can read and write, and everyone else can only read - good for web pages"
},
{
"command": "chmod 755 file",
"description": "you can read, write, and execute, and everyone else can read and execute - good for programs that you want to share"
}
]
},
{
"title": "Networking",
"commands": [
{
"command": "wget file",
"description": "download a file"
},
{
"command": "curl file",
"description": "download a file"
},
{
"command": "scp user@host:file dir",
"description": "secure copy a file from remote server to the dir directory on your machine"
},
{
"command": "scp file user@host:dir",
"description": "secure copy a file from your machine to the dir directory on a remote server"
},
{
"command": "scp -r user@host:dir dir",
"description": "secure copy the directory dir from remote server to the directory dir on your machine"
},
{
"command": "ssh user@host",
"description": "connect to host as user"
},
{
"command": "ssh -p port user@host",
"description": "connect to host on port as user"
},
{
"command": "ssh-copy-id user@host",
"description": "add your key to host for user to enable a keyed or passwordless login"
},
{
"command": "ping host",
"description": "ping host and output results"
},
{
"command": "whois domain",
"description": "get information for domain"
},
{
"command": "dig domain",
"description": "get DNS information for domain"
},
{
"command": "dig -x host",
"description": "reverse lookup host"
},
{
"command": "lsof -i tcp:1337",
"description": "list all processes running on port 1337"
}
]
},
{
"title": "Searching",
"commands": [
{
"command": "grep pattern files",
"description": "search for pattern in files"
},
{
"command": "grep -r pattern dir",
"description": "search recursively for pattern in dir"
},
{
"command": "grep -rn pattern dir",
"description": "search recursively for pattern in dir and show the line number found"
},
{
"command": "grep -r pattern dir --include='*.ext",
"description": "search recursively for pattern in dir and only search in files with .ext extension"
},
{
"command": "command | grep pattern",
"description": "search for pattern in the output of command"
},
{
"command": "find file",
"description": "find all instances of file in real system"
},
{
"command": "locate file",
"description": "find all instances of file using indexed database built from the updatedb command. Much faster than find"
},
{
"command": "sed -i 's/day/night/g' file",
"description": "find all occurrences of day in a file and replace them with night - s means substitude and g means global - sed also supports regular expressions"
}
]
},
{
"title": "Compression",
"commands": [
{
"command": "tar cf file.tar files",
"description": "create a tar named file.tar containing files"
},
{
"command": "tar xf file.tar",
"description": "extract the files from file.tar"
},
{
"command": "tar czf file.tar.gz files",
"description": "create a tar with Gzip compression"
},
{
"command": "tar xzf file.tar.gz",
"description": "extract a tar using Gzip"
},
{
"command": "gzip file",
"description": "compresses file and renames it to file.gz"
},
{
"command": "gzip -d file.gz",
"description": "decompresses file.gz back to file"
}
]
},
{
"title": "Shortcuts ",
"commands": [
{
"command": "ctrl+a",
"description": "move cursor to beginning of line"
},
{
"command": "ctrl+f",
"description": "move cursor to end of line"
},
{
"command": "alt+f",
"description": "move cursor forward 1 word"
},
{
"command": "alt+b",
"description": "move cursor backward 1 word"
}
]
}
]
}