Created by Maicon Alencar
over 5 years ago
|
||
Question | Answer |
PID - Which means | Proccess IDentification |
What is the proccess with PID 1 | Init |
two processes of the same application receives PIDs ______________ | different |
How to know what shell am I using? | #echo $SHELL |
Internal command is a command embedded on ____________ | shell |
in order to execute external commands, what variable shell should search location info? | PATH #echo $PATH |
which command shows if a program is internal or external | type #type tar #type cat |
#echo $PATH | /usr/local/sbin:/usr/local/bin:/usr:sbin/:/usr/bin:/bin |
/desktop/script.sh Is it an absolute or relative path? | relative |
/home/desktop/scripts/script.sh Is it an absolute or relative path? | absolute |
/etc/init.d/script.sh Is it an absolute or relative path? | absolute |
How create a variable in shell? | #name_variable=data |
How export variables in shell? | #export name_variable |
How create and export variable, in order to other shells sessions can see this variable data? | #export name_variable=data |
Which command shows all variable values? | #set #set | less |
Which command shows just external variables values? | #env #env | less |
An user opened a new shell and executed an external program without export. He received an error, why? | Because he executed the relative path and, in this case, external programs needs to be exported. Other way is execute the absolute path. |
How shows the value of a variable in shell? | #echo $variable |
Which variable shows the values as the command #history? | #echo $HISTFILE |
Which variable shows the length of the return of command #history | $HISTFILESIZE |
$HISTSIZE | is the number of lines or commands that are stored in memory in a history list while your bash session is ongoing. |
$HISTFILESIZE | is the number of lines or commands that (a) are allowed in the history file at startup time of a session, and (b) are stored in the history file at the end of your bash session for use in future sessions. Notice the distinction between file: on disk - and list: in memory. |
$HOME | home address of logged user |
$HOSTNAME | machine name |
$LOGNAME | login name that are logged into this session # echo $LOGNAME root |
$PATH | variable that indicate location of binaries |
$PWD | current folder |
$USER | login name that are logged into this session # echo $USER root |
$$ $! $? | $$ PID of this shell session $! PID of last proccess executed $? exitcode of last proccess executed |
a proccess was executed with success, what number its returns? | 0 |
#echo ~ | home of user logged # echo ~ /root |
#echo ~nameuser | home of user logged # echo ~sftp_usr/ /home/sftp_usr/ |
$PS1 | shell appearance |
$OLDPWD | last folder visited |
How execute three commands in the same line separating with a char? # clear date ls | #clear ; date ; ls |
&& | If the first command was executed with success, then, the second command will be executed #clear && date |
|| | Only executes the second command if the first command gets ERROR |
#!! | repeats the last command was executed |
#!19 | execute the number of the command likes the history 18 shodan scan 189.40.216.101 19 shodan scan submit 189.40.216.101 20 ping 8.8.8.8 |
#!uname | searchs for "uname" command in the history ($HISTFILE) |
how to clear HISTFILE? | #history -c |
Can I read the HISTFILE from another user being a normal user? | No. Just administrators users can user other user's history |
How to search a command in history? | CTRL + R OR | grep |
how command provides a detailed view of other command which includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS and SEE ALSO | #man means "manual" |
#man -k "string" | gives all commands that have the "string" as reference in manual #man -k "update system" fwupdate - update system firmware |
#whatis | #whatis ls ls (1) - list directory contents #whatis cat cat (1) - concatenate files and print on the standard output #whatis tar tar(1) an archiving utility |
#apropos | =man -k gives all commands that have the "string" as reference in manual #man -k "update system" fwupdate - update system firmware |
Which command returns system information? | #uname |
Which command returns exactly the following info: linux version, compilation date and kernel version | #uname -a |
How to create a nickname to a command? like the nickname of "cat" is "tom", then, when I use "tom" in shell, the system translate to "cat" | #alias tom=cat |
#echo * | show all files from local directory |
#echo "*" | the shell will just print * |
#echo '*' | the shell will just print * |
What is the difference between #echo "*" #echo '*' | "" - protect all these $ ` / not ' ' - protect ALL |
#echo "Curso Linux" #echo Curso Linux #echo Curso \ \ \ \ \ \ \ Linux #echo "Curso Linux" | Curso Linux Curso Linux Curso Linux Curso Linux |
Which command we can use to get a command path? | #which cat /usr/bin/cat #which tar /usr/bin/tar #which shodan /usr/local/bin/shodan |
How we get the release of kernel? | #uname -r OR #uname -a |
Want to create your own Flashcards for free with GoConqr? Learn more.