Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

REPORT FOR ASSIGNMENT 6: LINUX/UNIX SHELL ENVIRONMENT VARIABLES

Student Name Surname Student ID (nV) Date


Vladislav Likhachev 212238, n10 21.01.2023

3.1. Table. Shell Environment Variables Analyze.

Variable Short Description Type:ro-wr Your Linux Value


PATH It stores all the path lists users will look for when executing different commands ro /usr/local/sbin:/usr/
local/bin:/usr/sbin:/
usr/bin:/sbin:/bin:/
usr/games:/usr/
local/games:/snap/
bin

HOME It shows the home directory. ro /home/cisco


TERM t shows the current emulation of the terminal. ro xterm-256color
PS1 Used as the default prompt in the bash terminal. wr/ro
PS2 The value of this parameter is expanded as with PS1 and used as the secondary wr
prompt string.
LOGNAME Login User Name (account) WR stud
MAIL It shows the location of the current user's email (where it gets stored). ro
MAILCHEK It allows multiple mailboxes to be checked for the existence of mail. ro
HOSTNAME It shows the name of the host. ro
HOSTTYPE It shows the system type of the host. ro
HISTSIZE The number of commands to remember in the command history. The default value is ro
500.
HISTFILE The name of the file in which command history is saved. ro
TMOUT The default timeout for the read builtin command. Also in an interactive shell, the value ro
is interpreted as the number of seconds to wait for input after issuing the command. If
not input provided it will logou user.
IGNOREEOF It does not let you to log out + shows the warning message 10 times by default. wr
IFS The Internal Field Separator that is used for word splitting after expansion and to split wr
lines into words with the read builtin command. The default value is
<space><tab><newline>.
SECONDS It returns a count of the number of (whole) seconds the shell has been running. ro
OSTYPE It shows the operating system type. ro
PWD It shows the working directory. ro /home/cisco
OLDPWD It shows the previous working directory. ro
EDITOR It is the user’s file editor, and It is the editor that opens when you require it. WR
RANDOM It returns a pseudorandom integer in the range 0 – 32767. ro
SHLVL It shows the number of shell levels the current shell is running on top of. ro 1
SHELL It shows the user's shell, which can be bash or zsh. ro /bin/bash
PROMPT_COM Define a command that is executed every time before showing PS1. WR “Is -l”
MAND For PS1, PS2, PS3, and PROMPT_COMMAND, dynamically calculated escape
sequences exist, such as:
\w - current directory, full path;
\W - current directory, without path;
\u - username; \h - hostname;
\$ - $ for user and # for root;
\t is the time of day; \d - current date;
\s - the current shell; and others.
EUID This is the effective user ID, is what the system looks to when deciding what privileges wr
the process should have.
PPID It shows the parent process ID of your current context is exposed as an environment RO
variable.
GROUPS It lists all the groups and their details in the terminal. ro
3.2. Screenshot with Your Config-file content and working Clock.
3.3. TEXT COPY FOR YOUR VARIANT NR OF TASK.

v00. For All. Change the configuration files of your shell (example, bash) as follows:
a) At the beginning of the work session (after login procedure), a greeting should be displayed in the following format:
Hello UserName!
Next is the Calendar for the previous, current and next months in one line (cal -3).
b) At the end of the work session (after the exit command), a farewell should be displayed for 5 seconds in the following format:
Goodbye, UserName! You worked s seconds ($SECONDS).
where UserName is the user login name.

v10. Change the configuration files of your shell (example, bash) as follows:
c) A user’s primary prompt (PS1) should be dynamically changing (recalculated after each press of the Enter key);
d) PS1 format: "H" where H is a number, reflecting the size of your command history (history | wc);
e) The color of PS1 should be green on brown;
f) The color the rest of the command line should be white on brown;
g) PS1 must be inherited in child shells.
3.4. Text Copy of Your Modification for 3 Configuration Files
with the necessary comments:

˜/.bash_profile,

echo "Hello $USER!"


cal -3

˜/.bashrc,

echo "Goodbye, $USER! You worked $SECONDS seconds."


sleep 5

˜/.bash_logout.

PROMPT_COMMAND='PS1="$(history | wc -l) "'


PS1='\u \w \$'
PS1='\[\e[32m\]\u \w \$\[\e[m\]'
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
export ENV=~/.bashrc

You might also like