For each of these commands, you will execute the command in the Element K Unix e
ID: 3646527 • Letter: F
Question
For each of these commands, you will execute the command in the Element K Unix environment. You can find information on how to enter this environment in the Element K iLab tab under Course Home. Document your results using the lab report document provided in Doc Sharing. The list below shows you which commands you will be using. Please note that the lab report contains the actual command you will type. Document the result of each of the commands you execute, whether there is an observable result or not.COMMAND
who
whoami
date
cal
clear
ls
cd
pwd
man
printenv
sleep
history
This is what the lab looks like im not sure what to do at all?
Explanation / Answer
Who:If you want to know which users are currently logged in to your Linux system, which console they're using, and the date and time they logged in, issue the who command. You'll see output something like this: who root tty1 Nov 2 17:57 hermie tty3 Nov 2 18:43 sigmund tty2 Nov 2 18:08 In the output shown here, the term tty stands for teletype. In the olden days of computing, a terminal was just a keyboard with an attached printer, so you read everything off the teletype. If you've logged in with multiple virtual consoles and changed your identity on any of them, you may have some trouble figuring out who you are--or at least what user is logged in to the console you're using. If you find yourself in such an identity crisis, try this related command: whoami The whoami command will tell you the name of the current user. Just as a side note, you can also use the who am i command (a variant of the who command) to return the name of the current user. But it doesn't always work s you might expect. If you're logged in as root, and use the su command to switch to another user, who am i will return"root" as the current user. For this reason, I recommend that you train yourself to always use the whoami command when you want to know the current user name. Date:The date command under UNIX display date. It is also used to set date and time. You must be the super-user (root) to change the date and time. UNIX Date Command Syntax date date "+format" Task: Display Current Date and Time Type the following command: date Sample outputs: Tue Oct 27 15:35:08 CDT 2009 Task: Set The Current Time To set the current time to 05:30:30, enter: date 0530.30 Task: Set Date Set the date to Oct 25, 12:45 a.m., enter: date 10250045 Cal displays a simple calendar. If arguments are not specified, the current month is displayed. The options are as follows: -1 Display single month output. (This is the default.) -3 Display prev/current/next month output. -s Display Sunday as the first day of the week. (This is the default.) -m Display Monday as the first day of the week. -j Display Julian dates (days one-based, numbered from January 1). -y Display a calendar for the current year. Clear:Clears the screen. Syntaxclear Examples clear Clear the screen. Additional information Many newer Unix systems and Unix variants will also accept the cls command or have cls as an alias for clear Ls:Lists the contents of a directory . Syntax ls [-a] [-A] [-b] [-c] [-C] [-d] [-f] [-F] [-g] [-i] [-l] [-L] [-m] [-o] [-p] [-q] [-r] [-R] [-s] [-t] [-u] [-x] [pathnames] -a Shows you all files, even files that are hidden (these files begin with a dot.) -A List all files including the hidden files. However, does not display the working directory (.) or the parent directory (..). -b Force printing of non-printable characters to be in octal ddd notation. -c Use time of last modification of the i-node (filecreated, mode changed, and so forth) for sorting (-t) or printing (-l or -n). -C Multi-column output with entries sorted down the columns. Generally this is the default option. -d If an argument is a directory it only lists its name not its contents. -f Force each argument to be interpreted as a directory and list the name found in each slot. This option turns off -l, -t, -s, and -r, and turns on -a; the order is the order in which entries appear in the directory. -F Mark directories with a trailing slash (/), doors with a trailing greater-than sign (>), executable files with a trailing asterisk (*), FIFOs with a trailing vertical bar (|), symbolic links with a trailing at-sign (@), and AF_Unix address family sockets with a trailing equals sign (=). -g Same as -l except the owner is not printed. -i For each file, print the i-node number in the first column of the report. -l Shows you huge amounts of information (permissions, owners, size, and when last modified.) -L If an argument is a symbolic link, list the file ordirectory the link references rather than the link itself. -m Stream output format; files are listed across the page, separated by commas. -n The same as -l, except that the owner's UID and group's GID numbers are printed, rather than the associated character strings. -o The same as -l, except that the group is not printed. -p Displays a slash ( / ) in front of all directories. -q Force printing of non-printable characters in file names as the character question mark (?). -r Reverses the order of how the files are displayed. -R Includes the contents of subdirectories. -s Give size in blocks, including indirect blocks, for each entry. -t Shows you the files in modification time. -u Use time of last access instead of last modification for sorting (with the -t option) or printing (with the -l option). -x Displays files in columns. -1 Print one entry per line of output. pathnames File or directory to list. Examples ls -l In the above example this command would list each of the files in the current directory and the files permissions, the size of the file, date of the last modification, and the file name or directory. Below is additional information about each of thefields this command lists. Permissions Directories Group Size Date Directory or file drwx------ 2 users 4096 Nov 2 19:51 mail/ drwxr-s--- 35 www 32768 Jan 20 22:39 public_html/ -rw------- 1 users 3 Nov 25 02:58 test.txt Cd:Changes the directory .Syntax cd [directory] directory Name of the directory user wishes to enter. cd .. Used to go back one directory on the majority of all Unix shells. It is important that the space be between the cd and the .. cd - When in a Korn shell to get back one directory used to go back one directory. Examples cd hope The above example would go into the hope directory if it exists. cd ../home/users/computerhope The above example would go back one directory and then go into the home/users/computerhope directory. cd ../../ Next, the above example would go back two directories. cd Pwd:The pwd command displays the full pathname of the current directory. The syntax for the pwd command is: pwd * Please note that there are many flavors of UNIX,so if in doubt, consult your man pages. Man:The man command is short for manual and provides in depth information about the requested command or allows users to search for commands related to a particular keyword. Syntax Shows you online manuals on Unix commands. man [-] [-k keywords] topic - Displays the manual without stopping. -k keywords Searches for keywords in all of the manuals available. topic Displays the manual for the topic or command typed in. Examples man mkdir Lists help information on the mkdir command. man -k irc Printenv:printenv - print all or part of environment SYNOPSIS printenv [ VARIABLE ]... printenv OPTION DESCRIPTION If no environment VARIABLE specified, print them all. --help display this help and exit --version output version information and exit Sleep:sleep - delay for a specified amount of time SYNOPSIS sleep NUMBER [ SUFFIX ]... sleep OPTION DESCRIPTION Pause for NUMBER seconds. SUFFIX may be `s' for seconds (the default), `m' for minutes, `h' for hours or `d' for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number. History:history - Manipulate the history list SYNOPSIS history ? option ? ? arg arg ... ?
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.