linux programming Flashcards
list
ls
what are hidden files in ls
beginning with dot
list + show hidden files
ls -a
show username
whoami
make directory
mkdir directory
change directory
cd
go back (or up) one directory (switch to parent directory)
cd ..
current directory
cd .
get absolute pathname
pwd (print workind directory) - shows all parent directories
what 3 parts is unix made up of
kernel, shell and programs
what does the kernel of UNIX do?
The kernel of UNIX is the heart of the operating system. It
- allocates time and memory to programs and
- handles the file store and
- handles communications in response to system calls.
Illustration of how the shell and kernel work together
- User types rm file
- shell searches for filestore containing program rm
- requests kernel, through system calls, to execute rm on file.
- when rm file completes, system returns $ awaiting further commands
the shell in UNIX
acts as an interface between the user and kernel. The shell is a command line interpreter that allows users to type commands (or ‘talk’ to the kernel).
create empty file
touch fileName.filetype
move a file
mv (file to be moved) (move to this directory)
copy a file
cp (originalFile.filetype) (newFile.filetype)
remove file and directory
rm and rmdir but rmdir will only remove an empty directory
display contents of a file
cat (concatenate)
display first 10 lines in a file
head file.filetype
display first 5 lines in a file
head -5 file.filetype
write last 10 lines
tail file.filetype
grab word from a file
grep word file.
- remember is case sensitive
grep ignore cases
grep -i Science science.txt
other grep commands
-v show all not containing science
-n precede each instance with the line number
-c show count of matched lines