This article is meant to give you a basic idea about Linux command line codes . By reading this you will learn how to navigate through Linux directories , create a directory or file as well as some common methodologies used in Linux .Because I use Windows I am going to show you the Linux commands by opening ?Ubuntu on Windows?.
Clear the terminal screen:
clear
cleans the terminal .
Directory navigation
See the location of the pointer :
pwd
Show contents of folder :
ls
Move up:
cd ..
Move to specific folder :
cd folderNamenavigating
In the above scenario I used pwd,ls and cd to illustrate how we can move from from one folder to another.
Move to root:
cd /
Seeing the contents of a folder :
Show all files (hidden also):
ls -a
See all files and also details :
ls -lls -l provides us with details about the contents of the folder
In the privilege section of the owner section we can see that drwxr is written it means :
first letter is ?-?for File, d for Directory, l for Link
r ? read
w ? The file can be modified (write/delete/edit)
x ? execute
Changing permissions of a file or folder is a different topic altogether .We will skip that in this article.
make a new directory
mkdir directoryName
delete
rm -r directoryName rm nameOfFile rmdir directoryNamecreated and deleed a directory
rm -r is used when the directory is not empty.
make a file
touch f.txt
Open with an editor :
(I will open the file using vscode)
being in the same directory as file you want to open type:
code f.txt
another important thing you want is the use of tab button. when writing long filenames press tab and it will suggest names that exist in the directory.
see contents of a text file in the terminal :
cat f.txt
this helps when you need to look inside a small file.to see larger files use :
less f.txt
quit pressing ?q?.
Renaming a file :
mv f.txt newNamerename
copy a file :
cp newName.txt copied.txtnew file is created with the same contents of the old one
locating a file/folder:
which fileName/foldername
it outputs the path .
see what commands you used upto 500 :
history
update Ubuntu :
sudo apt-get updateit didnt work the first time
sudo means super user do .
See network information :
ifconfig
ping a website :
ping google.com
see own os information :
uname -a
See system usage data :
top
See disk space :
df
Install software :
sudo apt-get install Name
Remove/uninsall :
sudo apt-get remove Name
Restart computer :
sudo reboot
Shutdown Computer : (try anyone)
sudo shutdown -h nowsudo poweroff
This is by no means a comprehensive tutorial . My target was to introduce you to the commands that will start you off . For further reading you can explore here .
Share your opinions . 🙂 and please leave a clap or 50 😛 🙂
BYE!! .