Basic command Flashcards
CTRL+D == exit
man ‘command’
command manual
@6 jeld darad
** bazi dastoorat dar chand jeld hastand
man 5 passwd => mige az jeld 5 baraam bekhon
env
print envirenment variable
USER = The name of the logged-in user
PATH = List of directories to search for commands, colon separated
EDITOR = Default editor
HISTFILE = Where bash should save its history (normally .bash_history)
HOSTNAME = System hostname
PS1 = The Prompt! Play with it
UID = The numeric user id of the logged-in user
HOME = The user’s home directory
PWD = The current working directory
SHELL = The name of the shell
$ = The process id (or PID of the running bash shell (or other) process
PPID = The process id of the process that started this process (that is, the id of the parent process)
? = The exit code of the last command
if we want to print or use this character without interpretation we have to ?
* ?[]’”$;&()|^<>
quote them or use with \
echo -e “hello\nhello\thello\v”
@-e chizi ke baad az \ miaad ro tafsir mikone
mhdadizadeh=’mohamad\ hadi\ dadizadeh’
echo $mhdadizadeh
define envirenment var and print by echo
**space to bayad ba \ scape kard
**dastoor aval bayad bedoon fasele bashe
**var moghe echo baayad $ dashte baashe
export mhdadizadeh=hadi
@dar hame level ha taarif mishe
what happen when enter a command?
first : check if is a builtin command then execute
second : @file ha ee ka dar $PATH adderess dadim be tartib check mikone va age onja ham chizi peyda nakard error mide
PATH=$PATH:/home/mhdadizadeh/bin
add path to $PATH
@linux current dir ro ham baraye ejraye barname ha check mikone? why?
@na , be dalayel amniati
which ‘command’
@age in command ro bezanam chi run mishe?
The which command searches through the directories that are defined in the $PATH environment variable for a given filename.
unset env_var
unset envirenment variable
-v : unset shell var if exist
-f : unset shell func if exist
$HISTFILE Vs history
$HISTFILE : baad az exit command ha tooch save mishan
history : yek shell builtin command ast va dastorat haman moghe zakhire mishavan
Ctrl+R = Backward Search
Ctrl+O = Run the command you found with Ctrl+R
!! = Run the last command
!10 = Run command number 10 of history
!text = search backward for text, and run the first found command
whereis ‘command’
@khodesh va mokhallafatesh koja hastan
**baazi dastoorat chand ja hastan ya maani haye motafaveti daaran
whatis ‘command’
print first line of discription
** age chand ta tafsir dasht hamasho mide
type ‘command’
@yek command ro midi behesh va mige chetor tafsir mishe
**mamolan path file ejraee ro mide
cd /home/mhdadizadeh
Absolute Paths
** / means root dir
cd dir1/dir2/dir3
Relative Paths
cd
cd ~
cd $HOME
home dir
cd ~[username]
goes to another user’s home directory.
cd ..
moves one directory up.
cd -
moves to your previous directory
uname -a
Gives you data about the system
-s = Print the kernel name. This is the default if no option is specified.
-n = Print the nodename or hostname.
-r = Print the release of the kernel.
-m = Print the machine’s hardware (CPU) name.
-o = Print the operating system name.
-a = hameche ba ham
ls -R
lists all the files in the subdirectories