posted Jul 20, 2011, 3:36 PM by Neil Mathew
[
updated Oct 8, 2011, 9:39 PM
]
DAY 2: Learnt these commands:
touchtouch <filename> : Creates files without data
catcat > (existing/new filename) : Write data to file (also creates) cat < (existing filename) : Read data from file
>>> Try making some unique filenames.
>>> Since everyone is using the same server,
>>> your filename may match and cause unexpected results.
$ touch DONOTOPEN
$ cat > DONOTOPEN <-- Input
Now, why did you go and defy me?
<-- When finished typing, press Ctrl + D $ touch FOOLM1 FOOLM2 FOOLM3
$ cat > FOOLM2
Yosh.
$ cat > FOOLM1
DOOM DOT.
$ cat < FOOLM2 <-- Output
Yosh.
$ cat < FOOLM1
DOOM DOT. >>> Experimenting:
$ cat < FOOLM2 FOOLM1
DOOM DOT.
$ cat < FOOLM1 < FOOLM2
Yosh.
$ cat < FOOLM1 << FOOLM2
> hello?
> hello?
<-- Weird
> >> cat > (filename) : Input into File cat >> (filename) : Append into existing file
metalwihen@metalwihen:~$ cat > jumpo
Hello
metalwihen@metalwihen:~$ cat < jumpo
Hello
metalwihen@metalwihen:~$ cat >> jumpo
Jumpo
metalwihen@metalwihen:~$ cat < jumpo
Hello
Jumpo
mv
mv <filename1> <filename2> : Renames file from 1 to 2
cpcp <filename1> <filename2> : Copies from one to another
rmrm <filename1> : deletes file
$ touch Olaf
$ cat > Olaf
Boom Box Reloaded.
$ cat < Olaf
Boom Box Reloaded.
$ mv Olaf Heimer <-- Renamed
$ cat < Olaf <-- Therefore Olaf no longer exists
Olaf: cannot open
$ cat < Heimer
Boom Box Reloaded. $ rm Heimer <-- Deleted
$ cat < Heimer
Heimer: cannot open $ touch dwarf
$ cat > dwarf
Ain't I small?
$ <-- Just clicked enter, nothing to note here
$ cat <dwarf
Ain't I small?
$ cp dwarf Elf <-- Copy
$ cat <Elf
Ain't I small? $ touch miniME mini
$ cat >mini
SMALLER ME.
$
$ cat > miniME
SMALLER ME 2.
$
$ cat < mini
SMALLER ME.
$ cat < miniME
SMALLER ME 2.
$
$ cp mini miniME
$ cat < miniME
SMALLER ME.
$ touch 4576
$ cp mini 4576 <-- Here, copied to existing file
$ cat < 4576
SMALLER ME.
$ cp mini 02020202 <-- Assuming Noone created 02020202 & 0183 beforehand,
$ cat < 02020202 <-- file to which contents copied need not exist.
SMALLER ME.
$ cp mini 0183
$ cat < 0183
SMALLER ME.
-i<command> -i <files> : With Permission
$ $ rm -i mini miniME
remove mini ? y
remove miniME ? n
$ cat < mini
mini: cannot open
$ cat < miniME
SMALLER ME.
lsls: list files ( * - anything ) ( [ _ ] - any one character within brackets
$ touch mewi
$ touch metalwihen
$ touch metwih
$ touch metalwih
$ touch mewi2
$ ls me*
metalwih
metalwihen
metwih
mewi
mewi2
mein:
$ $ touch Gmetalwihen metalwihen imetalwihen Ymetalwihen
$ ls [Gi]metalwihen
Gmetalwihen
imetalwihen
$ ls [giY]metalwihen <--Note from G that file names are case sensitive
Ymetalwihen
imetalwihen $ touch mewi1 mewi2 mewi3 mewi4 mewi5 mewi6
$ ls mewi[1236]
mewi1
mewi2
mewi3
mewi6 <-- Since 4 and 5 not mentioned in square brackets, not shown $ rm mewi*
$ rm me*
rm: mein directory <-- Observation: 'mein' must be some important dir
$
|
|