Saturday, September 15, 2012

Unix file operation Commnads

appent to file cat >> cat >> file1
combine 2 files cat cat file1 file2 > file3
copy files cp cp myfile copymyfile
create a file cat cat > newfile
edit files vi vi file
list files ls ls bin/
move a file mv mv file1 doc/chapter1
remove a file rm rm unwantedfile
rename a file mv mv oldfilename newfilename
view files cat cat file pg pg file2 file3 more less view view file6 file7
change to another directory cd cd folder1/folder2/
create a directory mkdir mkdir myfolder
find out where you are pwd
go to your home directory cd
remove an emplty eirectory rmdir rmdir junk

Redirection of Output or Input

> redirects the output of a command to a file
>> redircts the output of a command to the end of an existing file
< takes the input of a command form a file, not the terminal

Summary of Basic Commands

cal cal 1 display a calendar
cal [month] year
month number between 1 and 12 year number between 1 and 9999
cal 2012 print calendar for year 2012
cal 1 2012 print calendar for January 2012

Unix command to view files, create files, append to files and combine files

cat cat(1) concatenate and display files
cat [options] [files]
cat files read file(s)
cat > file create file (reads form terminal )
cat >> file append to file (reads form terminal )
cat file2 >> file1 appends contents of file2 to file1
cd cd(1) shell built-in functions to change the current working directory
chdir cd(1) shell built-in functions to change the current working directory
chgrp chgrp(1) change the group ownership of a file
chmod chmod(1) change the permissions mode of a file
chown chown(1) change owner of file
clear clear(1) clear the terminal screen
cp cp(1) copy files
date date(1) print and set the date
dc dc(1) arbitrary precision desktop calculator
dos2unix dos2unix(1) convert text file from DOS format to ISO format
eject eject(1) eject media such as CD-ROM and floppy from drive
exit exit(1) shell built-in functions to enable the execution of the shell to advance beyond its sequence of steps
file file(1) file(1B) determine the type of a file by examining its contents
head head(1) display first few lines of files

ls      list the contents of a directory
ls [options] [directories]
the current working directory used if no directories specified
 few options:
           -a list all entries includeing hidden files (starting with .)
           -i print inode numbers
           -l long list (mode, links, owner, group, size, timeof last modification, and name
           -t sort by modification time
           -x multi-column list, sorted across each row

Mail, mailx mailx(1), mail mail(1) rmail interactive message processing system to read mail or send mail to users

mail [options] users
mail with no options, to read your mail
mail user to send mail to user
mail user < filename mail a file to another user
mkdir mkdir(1) make directories
more more(1) browse or page through a text file
mv mv(1) move files
pg pg(1) files perusal filter for CRTs
pr pr(1) print files
ps ps(1) ps(1B) display the status of current processes
pwd pwd(1) working directory name
rm rm(1) remove files or directories
rmdir rm(1) remove files or directories
spell spell(1) find spelling errors
tail tail(1) deliver the last part of a file
umask umask(1) shell built-in function to restrict read/write/execute permissions
unix2dos unix2dos(1) convert text file from ISO format to DOS format
vi vi(1) screen-oriented (visual) display editor based on ex
view vi(1) screen-oriented (visual) display editor based on ex

w w(1) who is logged in, and what are they doing
wc wc(1) display a count of lines, words and characters in a file
which which(1) locate a command; display its pathname or alias
who who(1) who is on the system
whoami whoami(1B) display the effective current username
whois whois(1) Internet user name directory service
write write(1) write to another user

1 comment:

  1. Hi thеrе colleagues, nice post аnd gοod arguments cоmmеnteԁ here, Ι
    am in fact enjoyіng by these.

    Feel free tο ѵisit my webpage ... AmerіcaѕCaгdRoom Pгоmotions - -