__________________________________________________
** Before we start the lab, please Install and Launch Linux. **__________________________________________________
Command retrieval and line editing
1. Type in all the commands below and press "Enter".
a) route
- "route" is used for showing or update the IP/kernel routing table.
- "uptime" is used to find out how long the system is active (running).
c) ls
- "ls" is used to list files or directions in Linux and other Unix-based Operating Systems.
d) date
- "date" is used to display the system date and time.
Output of all the commands above :
2. By pressing up arrow, the previous command will be shown.
Pressed up arrow 3 times :
Output after pressed up arrow 3 times :
___________________________________________
Filename auto-completion
1. Use "cd Desktop" to change to home directory.
2. Use "mkdir (filename)" to create a directory. For example, I used "mkdir Linuxbook" in this lab.
3. Change to Linuxbook using the command "cd Linuxbook". Then, insert the following commands :ls > file2.txt
ls > file3.txt
ls > file4.txt
ls > unique1.txt
4. Create one more file using command "ls > file1.txt"
5. Type command "ls -la u" and then press Tab. The rest of the filename "unique1.txt" will
appear. Press Enter.
6. Now type ls -al file and press Tab. Nothing will happen, and your console may
beep. Press Tab again. Now all 4 file names will appear.
7. Add a 4, press Tab again, and then Enter. The command ls -la file4 will run.
- "ls -al file4.txt" is shown after Tab is pressed.
-This is the output after Enter is pressed.
__________________________________________________
The shell prompt
1. The \u command means to show the current user of this shell.
-in this case, the user is linuxmint.
2. The \h command shows the hostname of this machine.
-in this case, the user is linuxmint201
3. The \w command means to show the full path of the current directory. This change
is highly recommended, as the user doesn't have to type pwd (Print Working
Directory) all the time to know what directory is being used.
-the output is symbol "~"
4. The \$ means to display a $ or # depending on the effective UID.
5. echo command is used to display the content of a variable.
**Below are others environmental terminals :
___________________________________________
1. 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. This can be done by putting $PATH: before the rest of the path.
:$PATH means the program will look for the path first before going to the current directory.
2. There is no content inside the EDITOR at first.
3. A path is assigned using command export.
4. An export can be removed by using "export EDITOR=", which is empty path.
__________________________________________________
Using aliases
By using aliases, we can easily create a simple command without having to type the full command next time.
Here, I used some alias command. This is the list:
alias cls="tput clear"
alias la="ls la"
alias lt="ls -latr"
**If you no longer want the alias, you can remove it by using the unalias command, for example,
"unalias cls", "unalias la", "unalias lt".
__________________________________________________
This is another example of alias command.
1. First we make directory named "linuxbook1" inside Desktop.
2. By using command ' alias lbook="cd Desktop.linuxbook1" ', we will be taken directly to the
directory using command "lbook".
3. This is another example using export and alias.
4. Command export set a path named LBOOK. Then, command ' alias lbook="cd $LBOOK" ' is used
and we no need to type the whole path.
5. Lastly, we can type command "lbook" to directly go to "linuxbook1".
1. The command "touch" is used to create, change and modify timestamps of a file.
2. The command "cp" stands for copy. This command is used to copy files or group of files or directory.
3. Here, we combined the commands export, alias, touch and cp to create a file named "f1.txt".
__________________________________________________
Thank you for reading. Feel free to ask me if you have any questions.
__________________________________________________
Comments
Post a Comment