Intro To Command Line
Index :?
- CLI Vs GUI
- Directory Operation
- File Operations
- Navigating in the FileCLI Vs GUI
- Directory Operation
- File Operations
- Navigating in the File System
- More File and Directory Operations
- Some more useful Commands
- Why use CLI over GUI?
- Display OS Information?
- Execute Commands as a superuser System
- More File and Directory Operations
- Some more useful Commands
- Why use CLI over GUI?
- Display OS Information?
- Execute Commands as a superuser
GUI vs CLI
- GUI - A graphical user interface, where we have graphical elements that you can interact with like buttons-
- CLI - Command line interface, where users type in commands and see the results printed on the screen
- Terminal - The GUI window that you see on the screen. It takes commands and shows output.
When you open terminal you'll see something appear on the screen
example@exam-ubuntu:~ $
here terminology,
- example = username
- exam-ubuntu = computer name
- ~ = home directory
- $ = represents regular user
- if you see, # = sign for root user
???? Directory Operation ????
commands:
pwd
- print working directory?
- show the current directory
?
ls
- List folders and files
cd [dir name]
- Change directory to [dir]
- ex - cd documents
mkdir [dir name]
- make directory [dirname]
- ex - mkdir project-list
???? File Operations ????
touch [filename]?
- create [filename]
- ex : touch main.txt , touch index.py
rm [filename]?
- Delete [filename]
- ex : rm main.py , rm touch index.py
cd ..
- Go up a directory
for example :
- /home/documents/projects $ cd ..
- /home/documents?
rm -r [dirname]
- Delete a non-empty directory and all the files within it
rm -d [dirname] or rmdir [dirname]
- Delete an empty directory
clear
- Clears the terminal
Note :?
- Everything in Linux is a File
- Text documents, Pictures etc
- Directories
- Commands, like pwd, ls etc.
- Devices like Printer, Keyboard, USB , CD
???? Navigating in the File System????
- if I want to go inside the user > local > bin , then I can simply write?
cd user/local/bin
- If I want to go to usr
cd ../..
or
cd /usr
cd [absolute path]
- Move to any location by providing the full path
- ex : cd /etc/network/
cd ~
- From home directory (or being in a particular directory) you can watch the file of other directory?
- I'm at home directory right now for example but I Want to check list of network directory?
领英推è
ls /etc/network
???? More File and Directory Operations????
mv [filename] [new_filename]
- Rename the file to a new filename
- ex : mv hello.txt main.txt
cp -r [dirname] [new_dirname]
- Copy dirname to new_dirname
cp [filename] [new_filename]
- Copy filename to new_filename
???? Some more useful Commands????
ls -R dirname?
- to show the contents of inside the folder Within the directory?
history
- Gives a list of all past commands typed in the current terminal session
history 20
- it will give us last 20 commands or any number you've specified?
ls -a
- Show all (including hidden)
cat [filename]
- Display the file content?
???? Why use CLI over GUI?????
- Work More efficient
- Instead of clicking through the file system, work in 1 terminal
- Easier for bulk operations
- CLI is more powerful?
GUI -
- Visual Tasks, like video editing?
???? Display OS Information ????
uname -a
- show system and kernel
cat /etc/os-release
- tell this is ubuntu distribution and this versions
lscpu
- Information about hardware?
lsmem
- Memory information
????execute commands as a superuser????
sudo?
- Allows regular users to run programs with the security privileges of the superuser or root
sudo adduser [name]
- to create a new user [require superuser permission]
su - [username]
- Switching between different users
???? Conclusion
- Practice the commands and post the screenshots of your practice.
- Make sure to tag me and mention as well in your post.
- My Geniuses, whoever is reading this article
- Make sure you all practice the commands over and over again.
This is just the basics. I will cover all the commands mentioned in this article in detail in the future.
?If you find my article useful and interesting, stay tuned for further updates and future articles?
-> Vijay Pandey
(Thumbnail credit to : Lauren Witte Girard)