Unix slideshare
-
Upload
mohan-k -
Category
Technology
-
view
391 -
download
2
description
Transcript of Unix slideshare
![Page 1: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/1.jpg)
Unix
Kernel and Shell
![Page 2: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/2.jpg)
ls List “normal” filesls file List only filels -a List all filesls –l Verbosely list normal filesls –al Verbosely list all filesls –al file Verbosely list only file
rm file Remove filerm –r dir Remove dir and all subdirs
mv file1 file2 Move/Rename file1 to file2mv dir1 dir2 Move/Rename dir1 to dir2
cp file1 file2 Copy file1 to file2
cd dir Change directoty to dirmkdir dir Make a directory dirrmdir dir Remove the directory dir
chown user file Change owner of file to userchgrp group file Change group of file to groupchmod nnn file Change permissions of file to
755 rwxr-xr-x700 rwx------644 rw-r--r--600 rw-------
locate file Find file (fast, not reliable)find dir –name file Find file in subdir of dir (very
slow, reliable)
File-system Management
![Page 3: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/3.jpg)
Account Managementpasswd Change your password
chsh Change your login shell
chfn Change your finger info
who Show who is logged in
w Show who is doing what
quota –v Show your disk quota info
du –k dir Show disk usage of dir
df –k Show file-system usage
![Page 4: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/4.jpg)
vi file Edit file in vi editorpico file Edit file in pico editorwc file Count words/lines in a filemore file Show contents of filehead –n file Show first n lines of filetail –n file Show last n lines of filegrep pattern file Search file for patterncat file1 file2 > file3 Append file2 to file1 and save results to file3
File Management
![Page 5: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/5.jpg)
top Show the top cpu processesps –elf Show info about all processeskill pid Kill process pidkill -9 pid Kill stubborn process pid^C Interrupt a foreground process^Z Suspend a foreground processjobs Show jobs from this sessionbg Send process to backgroundfg Send process to foregroundnice command Run command to lower priorityrenice –n n pid Lower priority of pid by ntime command Time the execution of command
Process (Job) Management
![Page 6: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/6.jpg)
Archiving and Compressiontar cf file.tar files Archive files as file.tar
tar xf file.tar Show info about all processes
gzip file Kill process pid
gzip –d file.gz Kill stubborn process pid
compress file Interrupt a foreground process
uncompress file.z Suspend a foreground process
Printinglpr file Print file to default printer
lpr –Pprinter file Print file to printer
lpq Show default print queue
lpq –Pprinter Show printer print queue
lprm - Purge default printer
lprm –Pprinter Purge printer
lprm job Remove job in default printer
lprm –Pprinter job
Remove job in printer
![Page 7: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/7.jpg)
Compilationcc options file1.c … fileN.c C
CC options file.C … fileN.C C++
-o file.x Create executable file called file.x
-g Include info for debugging
-0N Optimize executable
-lfoo Include library libfoo.a
The dbx Debuggerdbx C
rerun C++
stop in sub Create executable file called file.x
stop at N Include info for debugging
trace var Optimize executable
status Include library libfoo.a
delete N Delete Nth breakpoint/trace
delete all Delete all breakpoints/traces
cont Continue running (after a stop)
step Execute the next line and stop
next Same as step, but steps over calls
list List 10 lines of source
list N List 10 lines of source from line N
print var Print the value of variable
dump Print the value of all variables
quit Quit the debugger
![Page 8: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/8.jpg)
< file Redirect file to STDIN> file Redirect STDOUT to file>! file Redirect STDOUT to file (overwrite)>> file Redirect STDOUT to file (append)>& file Redirect STDOUT and STDERR to file| tee file Show STDOUT and copy to file| Redirect STDOUT of one command to
STDIN of another (ls | more)
I/O Redirection
Aliasalias Show all aliases
alias name Show alias name
alias name command Create an alias called name for command
![Page 9: Unix slideshare](https://reader036.fdocuments.us/reader036/viewer/2022082512/54b7258e4a7959b8098b4778/html5/thumbnails/9.jpg)
Environment Variables (csh/tcsh)
echo $var Show value of var
printenv Show value of all variables
setenv var value Set value of var to val
unsetenv var Remove the variable var