Some Basic Linux Commands
Basic Linux Commands used in Cloud Computing
- tty - reveals the current terminal
- whoami - reveals the currently logged-in user
- which - reveals where in the search path a program is located
- echo - prints to the screen means prints whatever you write same
- echo $PATH - dumps the current path to STDOUT
- echo $PWD - dumps the contents of the $PWD variable
- echo $OLDPWD - dumps the most recently visited directory
- set - prints and optionally sets shell variables
- clear - clears the screen or terminal
- reset - resets the screen buffer
- history - reveals the commands you used so far
- !685 - executes the 685th command in the history. NOTE - The command history is maintained on a per-user basis via --- ~/.bash_history~=user's $HOME directory in the BASH shell.
- pwd - prints the currently working directory
- cd - changes the directory to desired directory. NOTE - 'cd' with no option changes to the $HOME directory. 'cd~' changes to the $HOME directory. 'cd/' changes to the root of the file system. 'cd Desktop/' changes to the relative directory 'Desktop'. 'cd ..' changes to one-level up in the directory tree. 'cd ../' changes us two levels up in the directory tree.
- Arrow keys (up and down) navigates through your command history
- BASH supports tab completion -- type unique characters in the command and press "Tab" key.
- You can copy and paste in GNOME terminal windows using -- left button to block;; right button to paste OR Ctrl+Shift+v to paste.
- ls - lists files and directories.
- ls / - lists the contents of the '/' mount point.
- ls -l - lists the contents of a directory in long format which includes permissions, links, ownership, size, date, name.
- ls -ld /etc - lists the properties of the directory '/etc' and the contents of the '/etc'.
- ls -ltr - sorts chronologically from older to newer (bottom).
- ls --help - returns possible usage information.
- ls -a - reveals hidden files. NOTE - The files which are pre-fixed with '.' are hidden. Ex-.bash_history
- cat - catenates files
- cat 123.txt - dumps the contents of '123.txt' to STDOUT
- cat 123.txt 584.txt dumps both files to STDOUT
- cat 123.txt 848.txt > 789545.txt - creates new catenated files.
- mkdir - creates a new directory.
- mkdir testRH5 - creates a directory.
- cp - copies files
- cp 123.txt testRH6/By default, 'cp' does not preserve the original modification time.
- cp -v 488.txt testRH6/
- mv - moves the files.
- mv 186.txt testRH5/ - moves the file, preserving timestamp.
- rm - removes files and directories.
- rm -rf 245.txt - removes recursively and enforces.
- touch - creates blank file/updates timestamp
- touch test.txt - will create a 0-byte file, if it doesn't exist
- touch 158268.txt - will update the timestamp
- touch -t 681684658723585 446895.txt - changes timestamp
- stat - reveals statistics of files
- stat 123485.txt -reveals full attributes of the file
- find - finds files using search patterns.
- find / -name 'fstab'Note: 'find' can search for fields returned by the 'stat' command
- alias - returns/sets aliases for commands
- alias -dumps current aliases
- alias copy - 'cp -v'.
Comments