Terminal Commands Quick Start for Ubuntu 16.10
Hi! This tutorial will guide you step-by-step on How to Getting-Started with the Bash Commands on Ubuntu 16.10 Yakkety Yak GNU/Linux.
First, this is Just a ‘Quick and Dirty’ Introduction to the Command Line by Example on the Console/Terminal Bash Shell emulator.
Most noteworthy: this Tutorial is Step-by-Step and you Can Just Getting-Started Following and Executing each Command without any Harm for your System :)
Moreover, take into account how only the ‘Practice Makes the Master‘; so ‘Take it Easy!‘ ;)
Finally, most Commands should Works also on the others Linux Shells like: Bourne, C, TC and Korn.
-
Launching Ubuntu Terminal
Press: Ctrl+Alt+t
Or: Cmd/Win and Search ‘terminal’
Press “Enter” to Execute Commands on Console -
To List a Directory’s Contents
(Directories and Files included)
ls /[path]
For Example to List the Content of the Root Directory:
ls /
Or to List the Content of the Home Directory:
ls $HOME
-
To Change Directory
cd /[path]
But to Go into the Home Directory simply:
cd
-
To Make Directories and Files
To Create a Directory do:
mkdir /[path]/myDirectory
For Instance:
mkdir $HOME/livingroom
To Create a Blank File do:
touch /[path]/myFile
For Instance:
touch $HOME/livingroom/box
And how you could already have perceived, in my creative Examples I make use of the following Mnemonic Linking:
-
Directory -> Spatial Entity
-
File -> Thing
And so in the Previous Command to an “Empty File” corresponds a natively “Empty Thing” like a “box”, or otherwise you may take it as a simple Label/Name ;)
-
-
To Copy Directories and Files
To Copy a Single File:
cp /[path1]/myFile1 /[path2]/
Or also Setting a New File’s Name at the same time:
cp /[path1]/myFile1 /[path2]/myFile2
And to Copy Multiple Files at once:
cp /[path]/myFile1 ... /[pathN]/myFileN /[pathX]/
(After a ” Backslash the Command is Not Executed but follows in the Next Line)
For Instance to Copy a Single File:cp $HOME/livingroom/box $HOME/bedroom/
Then to Copy a Single Directory with all its Contents:
cp -r /[path1]/myDir1 /[path2]/
Or Setting a New Name:
cp -r /[path1]/myDir1 /[path2]/myDir2
Again to Copy Multiple Directories:
cp -r /[path1]/myDir1 ... /[path]/myDirN /[path2]/
Now for Instance to Copy a Single Directory do:
cp -r $HOME/livingroom $HOME/hello
-
To Move Directories and Files
Moving a Single File:
mv /[path]/myFile1 /[path]/toTargetDirectory/myEventualNewFileName
To Move Multiple Files:
mv /[path]/myFile1 ... /[path]/myFileN /[path]/toTargetDirectory/
And the Same Command is Valid Also for Directories!
Now for Instance to Move a Single File do:mv $HOME/livingroom/test $HOME/hello/hello
-
To Delete Directories and Files
To Delete a File do:
rm /[path]/myFile
For Instance:
rm $HOME/livingroom/test
And to Remove a Directory do:
rm -rf /[path]/myDirectory
So for Example:
rm -rf $HOME/livingroom
“-rf” is a combination of Flags. “r” for Recursively and “f” for Forced
-
How to Get the Admin Super-Powers
To Login as SuperUser:
sudo su
If Got “User is Not in Sudoers file” then see: How to Enable sudo
Then to Logout:exit
To Protect your System from the potential Damage of an Hazardous Crazy Command Execution the Logout should be executed every Time your Setup is Achieved!
Finally, to Execute a Single Command as SuperUser:sudo su -c 'myCommand'
Or:
sudo myCommand
So for instance to List the Protected root Directory try to run:
sudo ls /root
-
How to Set Permissions on Ubuntu File System
Here is achieved the ‘Quick&Dirty’ Initiation to the Ubuntu Command Line Sphere :)
I’ll be Back Very Soon to Show the Basics of the Apt Software Packages and Repository Administration Commands!