1) Enter those command as shown below:-
route
uptime
ls
date
sync
After that the result be shown as the picture:-
2) By pressing up arrow one time, command sync will appear in your terminal:-
3) Press the up arrow two time again, command date and ls will appear in your terminal:-
PART 2 Using history
1) Enter command as shown below:-
History
After that the result be shown as the picture:-
PART 3 Filename auto-completion
1) Create a file in Desktop
OR
Enter command as shown below:-
cd Desktop
mkdir Linuxbook
*cd is to change your current working directory
*mkdir is to create a file
You may find your file in your Desktop as the picture shown below:-
2) Next, create 5 text document in Linuxbook.
You may create file in your folder
OR
Enter command as shown below:-
cd Linuxbook
ls > file2.txt
ls > file3.txt
ls > file4.txt
ls > unique1.txt
ls > file1.txt
You will get the the result as shown in the picture below:-
3) Follow on enter command as shown below:-
ls -la [Tab]
By pressing [Tab] you will find all the find text document from unique1.txt , as the example shown in the picture below:
*[Tab] can be use to save time and effort without typing the full name of the file and reduce error.
PART 4 The shell prompt
A standard terminal usually has a rather cryptic command line prompt. This should be changed by modifying the PSI environment variable.
1) Enter command as shown below:-
export PS1="\u \h \w \$"
*\u command means to show the current user of this shell.
*\h command shows the hostname of this machine.
*\w command menas to show the full path of the current dicrectory.
*\$ means to display a $ or # depending on the effective UID.
The picture in below show my username, hostname, current directory and $.
Each colour of square represent the output for each command input.
PART 5 Other environment variables
1) Enter command as shown below:-
echo $PATH
The result will list of directories that will be searched for anything that you type on the command line. If you type in a built-in command like ls, it will look for a specified list of directories.
Your result should be shows approximately like this:
export PATH=".:$PATH"
echo $PATH
Prepending a dot to the PATH means the program will be looked for in the current directory first, before searching the rest of the path. This is very useful during the code development for example.
Your result should be shows approximately like this:
3) The EDITOR variable can be set to your favourite text editor. Most people use vi; however ,you can point it to the one you want, if you change this, be sure to use the full path.
To change the EDITOR variable follow the command below:
export EDITOR=/lewis/bin64/kw
5) Lastly, to remove an export by setting it to nothing can be done easily.
Enter command as shown below:-
export EDITOR=
Your result should be shows approximately like this:
PART 6 Using Aliases
An alias is for making your own commands!
That means that you can make a long command to a command to your liking.
1) Enter command as shown below:-
tput clear
2) Next, enter command as shown below:-
alias jj="tput clear"
Now when you run jj it will do the same thing.
3) To create a long directory listing enter the command as shown below:-
alias la="ls-la"
la
Your result should be shows approximately like this:
4) To show a long listing with the most current files last enter the command as shown below:-
alias lt="ls -latr"
Your result should be shows approximately like this:
5) You can easily delete alias that you don't want by tying the command as below:
unalias jj
If you try enter the alias the again, it will show this:-
You can also use aliases to move around the filesystem efficiently. This is very handy and will save you an incredible amount of typing. Try these examples out:-
6) Enter command as shown below:-
mkdir /home/linuxmint/linuxbook
alias lbook="cd /home/linuxmint/linuxbook"
lbook
Your result will be shown as in the example below:-
To make it more quicker, you may try this out!
7) Enter command as shown below:-
export LBOOK="/home/linuxmint/linuxbook"
alias lbook="cd $LBOOK"
lbook
As you can see, running lbook will take you to the directory as shown above. However, you can also use the LBOOK variable to copy files to that directory:
cd /tmp
touch f1.txt
cp f1.txt $LBOOK
The file f1.txt will now exist in the /home/linuxmint/linuxbook directory. This becomes even more handy when extremely long filenames are used.
Lab 1 will end right here, if you have any problems don't hesitate to let me know, just comment below and I will try to help you out!
LET'S MAKE A LITTLE BIT PROGRESS EVERY DAY AND YOU SEE
THE POWER OF SMALL CHANGES
nice post man it helps me solve my problem thanks!!
ReplyDeletethanks for the work, nice reference for me
ReplyDeletesir when can u upload part 4
ReplyDeletedone bro
Delete