linux commands Flashcards
pwd
Print the working directory you are in
cd ..
return to the previous directory
ls
list all files in the working directory
ls –rtl
display detailed information about all files in the working directory and sort by their
modification time in ascending order
ls –l
display detailed information about all files in the working directory
cd
change the working directory to your home directory
mkdir test
short for make directory. used to create directories on a file system
rmdir test
short for make directory. used to create directories on a file system
rmdir test
short for remove directory. used to remove/delete directories on a file system
chmod [newpermission] [filenames]
u : user (yourself)
g: group
o: others (rest of the world)
a: all of the above (u, g and o)
-:remove this permission
+: add this permission
r: read access
w: write access
x: execute access
chmod g-r test
remove read access form group
chmod uog+rwx test
add read, write and excesute access to user, group and others
who
get the information on curreclty logged in users
ps -ef
see processes on the system. pipes the output to “less” to make it scrollable
ps -fu user4
see processes on user 4 system
finger
used to display information about local and remote users (similar to who)
ifconfig -a:
display the status of all interfaces, even those that are down (show IP adress)
kill -9 2168
the kill command is used to terminate processes without having to log out or reboot (restart) the computer. 2168 is the PID of the process
PPID is
the parent process ID of PID
definition od bash
the standard shell for common users (linux)
korn shell
unix shell
ksh
used to change execution method to ksh
exit after ksh
used to exit ksh
scripts
collection of commands that are stored in a file. the shell can read this file and act on the command as if they were typed at the keyboard
vi test.sh
short for visual text editor. create test.sh (script) file, it is an interactive test editor.
echo “hello world”
show hello world on the screen
sleep 10
stop processes for 10 seconds
./test.sh
to excute the script
find . -name toto -print
automatically find the file’s path by its name
explane . in
find . -name toto -print
start search from currect location
explane toto in
find . -name toto -print
name of the file is toto
explane -print in
find . -name toto -print
show the location (path) on the screen
cd /etc
etc:
location where there are files controlling the machines configuration like IP adress. It is one of the system directories.
ls -rtl resolv.conf
get detailed information about resolv.conf only
find / -name resolv.conf -print
search the entire machine for file “resolv.conf” and print the path on the screen (usually the system does not allow, therefore you must log in the root)
find / -name resolv.conf -print | more
show the output in pages because ( | more ) is used
find / -name **ress** -print
this command is used if you are trying to find a file that you only remember a few letters of those letters are put in this letters ** ** the stars indicate any letter
find / -name **ress** -print > toto
save the output of the search in file (toto). file toto is created automatically due to this command and the output is automatically in the file
passwd
changes the password
vi toto
opens a file