Linux Basic Commands
- kyuande johnson
- Oct 3, 2022
- 2 min read
Pwd - Print Working Directory
- It prints the path of the working directory, starting from the root.
- Useful when your not use what directory that your in
Ls - List files and directories
Green - Files
Blue = Folders
Other "LS Options"
Ls -l
List more comprehensive results shows file permissions,
ls -a or ls -all
- Displays hidden files
ls -t
- Sort output by modification date listing the oldest modification date as last
Clear - clears terminal
Cd - change directory
Autofile by pressing “tab” key
“Example”
Cd Desktop/
Changes to desktop
Cd ~
Changes back to home directory (Shortcut)
touch - creates a new file (empty)
“Touch “mytextfile.txt”
Creates a text file
Echo - places text into file
Example of command:
Echo “Ham” > mytextfile.txt
Places the word “Ham” as content of the file
To add extra line run
Echo “Cheese” >> mytextfile.txt
Place the word “Cheese” after “Ham”
Output:
Echo “Cheese” >> mytextfile.txt
Ham
Cheese
Rm - remove command
Example
Rm mytextfile.txt
Removes the txt file
Mv - move command
Example: Change the name of a file
Mv “Name of the original file” “Name of the New File Name”
Example
Mv mytextfile mytxtfile
Changes “mytextfile to mytxtfile
Move a file in another file
mv mytxtfile Documents/
Moves “mytxtfile to the Documents folder
Cp - copy command
Example
Cp mytxtfile.txt mytxtfile2.txt
Copies the same files and renames it
Mytxtfile - mytxtfile2
Whoami - show you the user you are operating under
Host name - show you the name of the host
Mkdir - command that makes new directories
Example
Mkdir “AmazingStuff”
Makes a folder called “AmazingStuff”
Rmdir - removes directories
Prevents the removal of hundreds of files
Example
Mkdir “AmazingStuff”
Removes the newly created AmazingStuff” directory
Man - Manual page for resourceful information
Example
Man pwd
Shows you information of the pwd command man


Comments