Shell Basic Command Quick Start - wwangdev/wwangdev.github.io GitHub Wiki
#Shell Basic Command -- Quick Start
Shortcut Key
- Ctrl+Alt+F1-F6: switch Terminal.
- Ctrl+Alt+F7: switch to Desktop.
- tab: auto-completion.
- tab tab: list all options for completion.
- Ctrl+u: delete current command line
Need to Know
- $ -- User, # -- root.
- Linux is Case Sensitive!
- /etc/: system/software configuration files.
- All system commands are files in /usr/bin/.
- Wildcard:
- *: any char any length.
- ?: any char length 1.
- []: option.
- [1-9]: option with range.
- ../: parent directory.
- ./: current directory.
- ls -F:
- blue, ended with /: directory
- text: black
- executable, ended with *: green
- link, ended with @: light blue
- Run app without terminal hang on: &
- who: who are logged in.
- whoami: who is current user.
- uname: current system info. -a: detailed system info, -r: version info.
- man: help. J: down, K: up.
- whatis: function description.
- apropos: use key word to find function (regex permitted).
File Manipulation
View Directory
- cd: change directory.
- /: root directory.
- ~: user directory.
- Empty: user directory.
- .. : parent directory.
- ls: list files.
- -a: show hidden files (begun with .)
- -F: show file types (/,*,@)
- -l: show property: rwx, links, owner, group, size, last modified date, last modified time, file name
- -ld: show property of a folder.
- +directory: list files in the directory
- pwd: current work directory.
- vdir: ls -l.
Find Files
- find: find [Path] -option file.
- -name: Ex: find /usr/bin/ -name zip
- -type: b: block, f: file, c: char device, p: pipeline, d:directory, l: link
- -atime (+/-)n: accessed (more/less than) n days ago
- -mtime n: modified n days ago
- locate: locate filename. Use updatedb to update database.
- whereis: find executable(and source) files. -b: only find executable file. (Could find in /usr/bin or /usr/share/man).
View File
- cat: display file content, -n: display line number.
- more: display file content by page, Q to exit.
- head: -n, first n lines.
- tail: -n, last n lines.
- less:
- space: next page
- b: previous page
- /word: search word, / again, search next
- -M: more details
- Q: exit
- grep: search word(use ' ' if space) in a file.
- egrep: both grep and egrep support regular expression.