Sunday, May 5, 2013

Quick Linux (2): Files

Files
rm -i #rm waits for a response first

cat file.txt #content of file

less #content of the file with "end"

more #content of the file without "end"

hostname #hostname!

cp #copy from source-file to destination-file, If the destination-file exists before you give a cp command, cp 
overwrites it.
cp -i #gives a warning if the file exist

mv #from existing-filename new-filename, also destroys existing files. use it to rename
mv -i $with warning 

lpr #printing

grep 'string' file #searches file for string (more on grep later)

head file #displays beginning of a file

tail -5 file #displays last 5 lines of a file

sort #displays file in order without changing it -u (unique lines only) -n (numerical order)

uniq #displays with duplicates removed

diff #comparing two files (try with -u)


file #look at file properties

date #date 

script #record session followed by exit to stop recording


No comments:

Post a Comment