When you first open the terminal, the first command you may type could be:
ls
It will display the contents of the current directory.
If there is nothing in it, it will not display anything.
A current alias for this command, is:
ll
This is an alias for:
ls -l
The -l option, asks the
request to the ls command
to display more informations.
If there is nothing in the current directory, it will probably display:
. ..
with the ls -a option.
It is also possible to combine several
options: ls -al.
You can probably create a new directory
with the mkdir command:
mkdir dir_name
You can later remove this directory
with rmdir:
rmdir dir_name/
This operation will be operated, only if the directory is empty,
otherwise it will display:
directory not empty
When ls is invoked with
-a, the two characters .
and .. are there to stand for:
.: the current directory...: the parent directory.If you try to type:
cd .
You will just stay at the current place.
cd
is a cmd which means: change-directory.
If you type it with-no arguments
it will change you to the default
start - dir.
You can create a new file in the current dir w/ vim:
$ vim file.txt
:wq
type the :wq to exit.
It will leave w/ an empty
file.
Learn more vim w/: vim-tut.
versions of this file.
You can probably convert an .html file to a raw
.txt file with:
$ links -dump file.html > file.txt
Then you can read the result with less:
$ less file.txt
You can also read the result with a pipe:
$ cat file.txt | less -
The - character is there to read the input of
the pipe. The ouput of the cat command is re-direct'd
the next command through the pipe.
If you just do:
$ cat file.txt
You will notice that the result of the .txt file
is dump'd to the console.
A symbolic links can also be creat'd with:
$ ln -s src.txt dst.txt $ ll lrwxrwxrwx 1 usr usr 15 Nov 16 18:22 dst.txt -> src.txt
r means you can read the file,
w, that you can write it, and x
stand for eXecute.
When you read:
rwx rwx rwx
the three fst letters are for you, the three after are for
your friends, and the last ones are for the others,
and the l indicate that it's a
links
The signature of a file can be obtain'd w/:
$ md5sum file.txt 06f3c26ede20391a08f6cea877c0f04a
If two files have the same signature, it means their content are the same.
On a system similar than a debian a new cmd
can be acquire'd w/:
$ sudo apt-get install links
An interest'ng cmd is tree.
$ tree .
. ├── doc/ │ ├── git-tut/ │ │ └── git-tut.html │ ├── index.html │ └── scratch-tut/ │ ├── scratch-tut-b.html │ └── scratch-tut.html ├── file2.txt ├── file3.txt ├── file.html -> unix-cmd-2.html ├── file.txt ├── tut/ ├── u/ │ └── u.txt ├── unix-cmd-2.html ├── unix-cmd.html └── versions.html 6 directories, 12 files
w/ it, you can visualize the result of a tree
structure w/ dirs and files.
Two usefull commands are du -h and df -h:
$ du -h . 0 ./u 0 ./tut 4.0K ./doc/git-tut 16K ./doc/scratch-tut 24K ./doc 12K ./.gil 52K .
$ df -h Filesystem Size Used Avail Use% Mounted on ---------- ---- ---- ----- ---- ---------- /dev/vdb 14G 5.1G 8.2G 39% / none 492K 4.0K 488K 1% /dev 9p 3.9G 1.9M 3.9G 1% /mnt/chromeos tmpfs 3.3G 0 3.3G 0% /mnt/external fonts 2.0G 1.9G 86M 96% /usr/share/fonts/chromeos devtmpfs 3.3G 0 3.3G 0% /dev/tty tmpfs 1.3G 120K 1.3G 1% /run tmpfs 659M 24K 659M 1% /run/user/1000 tmpfs 128M 17M 112M 14% /mnt/chromeos/MyFiles/Ramdisk2
It prints the size of the current place, and the
space in use of the global of the area.
$ tree -fi dump's it flat.
How to copy-paste in the console?
w/ the pointing device, you can double-click on a word, in the
console, this word will then be place'd in the copy-buffer.
You can then paste it at the cursor location w/:
Shift+Insert.
You can rename a file with the mv command:
$ mv file.txt new_name.txt
It's possible to duplicate a file w/ cp:
$ cp file.txt dup.txt
You can also move a file to another directory:
$ mv file.txt dir_name/