Welcome To The World Of Linux
COMMANDS
ADMINSRATIVE ACCESS -
Sudo Su
`Sudo`
Sudo stands for "superuser do". It allows user to execute a command as another user with root privileges
`Su`
Su stands for "substitute user" or "switch user" . This command temporarily allows you act as a different user . It switches the current user to the root user.
`Sudo su`
Using
sudo su
you can effectively manage your linux system with the necessary administrative privileges because you will be operating as a root user.Example:
Type
sudo su
in the terminalEnter your user password when prompted. When typing in your password it will be invisible
After successful authentication, your command prompt will change (typically from
$
to#
), indicating that you are now operating as the root user as seen in the Image below
PACKAGE MANAGEMENT -
apt update
Is a system by which software can be installed, updated and queried.
Run this command
apt update
to update package lists for upgradesRun
apt upgrade
to install the newest versions of all packages currently installed on the systemRun
apt list --upgradable
is to list all packages that have available updates
CHANGE DIRECTORY -
Cd
- Directories are a type of file used to store other files which provide a hierarchical organizational structure. Directories are equivalent to folders on windows
mkdir
- Run this command mkdir <name your directory>
to create a new directory
cd
- Run this command cd <name of directory>
to change current directory to "the directory created 'techfolder' as seen in image below with the pointy arrow
cd ~
- This command returns you to your home directory
CREATE FILE -
touch <"file1.txt", "file2.txt", "file3.txt">
As the commands shows we created three new empty files
ls
- This command lists the contents of the current directoryls -r
- This command shows your results in an alphabetical orderls -1
- Use this command to verify information in your file. It gives a long display output about files listedREMOVE FILE (rm) -
sudo rm <name of file>
Deletes "file1.txt" from the current directory with superuser privileges
This command is to delete files and directories
To remove a directory or delete a directory run command
sudo rm -r <name of directory>
- MOVING FILE (mv) -
mv file3.txt <name of directory>
Created a new directory named "cloudfolder"
Run the command above to move "file3.txt" into the "cloudfolder" directory
Change the current directory to "cloudfolder"
PRINTING WORKING DIRECTORY (pwd) -
pwd
This command helps you discover where you are currently located within the file system.cd ..
- To move out of a directory
OPEN TEXT EDITOR -
vi <file name>
vi
Opens the "techfolder" directory with thevi
editor.
9a. EMPTY TEXT FILE
9b. INPUT YOUR TEXT (Writeup) - Very importantly before you can write, type or use this blank space "Click On" the letter "I" on your PC keyboard
To exit press on the "esc" button on your pc keyboard and type":wq"
and press "enter"
10. FILES (cat) -cat<name of file>
This command displays all the entire contents of the file, recommended for small files
INSTALL VIM TEXT EDITOR -
sudo apt install vim
sudo apt install vim
run this command on the terminal and press "Enter". NOTE: You can either use 'vi' or 'vim' as a text editor
11a. SUCCESSFULLY INSTALLED VIM
INPUT TEXT USING `vim` COMMAND - Run command `vim file3.txt' to open up an empty text editor
12a. To begin typing or using space once the blank text area opens, first press the letter "i" on the keyboard.
Input text
To save and exit "Click On" the "esc" button on your keyboard and type " :wq"
VIEW CONTENT OF THE FILE - Displays the contents of "file3.txt" in the terminal using command
cat file3.txt
EXIT - This command
exit
closes the current terminal session and takes you back to rootCLEAR - This command clears all previous commands and output from the terminal screen, providing a clean workspace
HISTORY - The
history
command helps you keep track of the commands you’ve executed in the terminal session, which can be useful for recalling complex command sequences or troubleshooting issues.LOVE LETTER TO MYSELF!!!!
CONCLUSION
Each of these commands is fundamental for managing files, directories, and packages in a Linux environment. They are essential tools for navigating the filesystem, editing text files, and maintaining the system's software