You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
231 lines
6.6 KiB
231 lines
6.6 KiB
= An Introduction to Linux !
|
|
Apostolos rootApostolos@swarmlab.io
|
|
// Metadata:
|
|
:description: Intro and Install
|
|
:keywords: Linux, apt
|
|
:data-uri:
|
|
:toc: right
|
|
:toc-title: Πίνακας περιεχομένων
|
|
:toclevels: 4
|
|
:source-highlighter: highlight
|
|
:icons: font
|
|
:sectnums:
|
|
|
|
include::header.adoc[]
|
|
|
|
|
|
{empty} +
|
|
|
|
|
|
[[cheat-Docker]]
|
|
== Install swarmlab-ls (Home PC)
|
|
|
|
HowTo: See http://docs.swarmlab.io/lab/sec/sec.adoc.html
|
|
|
|
|
|
.NOTE
|
|
[NOTE]
|
|
====
|
|
Assuming you're already logged in
|
|
====
|
|
|
|
== Absolute basics
|
|
|
|
.Absolute basics
|
|
[options="header,footer"]
|
|
|=======================
|
|
|Command| Meaning
|
|
|ls| Displays a list of files in the current working directory, like the dir command in DOS
|
|
|cd directory| change directories
|
|
|passwd |change the password for the current user
|
|
|file filename| display file type of file with name filename
|
|
|cat textfile| throws content of textfile on the screen
|
|
|pwd| display present working directory
|
|
|exit or logout| leave this session
|
|
|man command| read man pages on command
|
|
|=======================
|
|
|
|
|
|
=== Key combinations
|
|
.Key combinations
|
|
[options="header,footer"]
|
|
|=======================
|
|
|Key or key combination| Function
|
|
|Ctrl+C| End a running program and return the prompt
|
|
|Ctrl+Z| Suspend a program
|
|
|ArrowUp and ArrowDown| Browse history. Go to the line that you want to repeat, edit details if necessary, and press Enter to save time.
|
|
|Tab| Command or filename completion; when multiple choices are possible, the system will either signal with an audio or visual bell, or, if too many choices are possible, ask you if you want to see them all.
|
|
|Tab Tab| Shows file or command completion possibilities.
|
|
|Shift+PageUp and Shift+PageDown| Browse terminal buffer (to see text that has "scrolled off" the screen).
|
|
|=======================
|
|
|
|
=== ls -l
|
|
|
|
[source,bash]
|
|
----
|
|
# ls -al
|
|
drwxrwxr-x 4 zeus zeus 4096 Οκτ 23 21:55 .
|
|
drwxrwxr-x 9 zeus zeus 4096 Οκτ 15 14:28 ..
|
|
drwxrwxr-x 8 zeus zeus 4096 Οκτ 23 21:55 .git
|
|
drwxrwxr-x 4 zeus zeus 4096 Οκτ 14 20:24 install
|
|
crw------- 1 root root 5, 1 Οκτ 23 21:22 console
|
|
lrwxrwxrwx 1 root root 11 Οκτ 23 21:21 core -> /proc/kcore
|
|
drwxr-xr-x 4 root root 100 Οκτ 23 21:22 cpu
|
|
crw------- 1 root root 10, 59 Οκτ 23 21:21 cpu_dma_latency
|
|
crw------- 1 root root 10, 203 Οκτ 23 21:21 cuse
|
|
-rw-rw-r-- 1 zeus zeus 1517 Οκτ 23 21:55 INSTALL.md
|
|
-rw-rw-r-- 1 zeus zeus 33883 Οκτ 15 14:28 LICENSE
|
|
-rw-rw-r-- 1 zeus zeus 691 Οκτ 17 11:13 README.md
|
|
----
|
|
|
|
==== File types
|
|
|
|
This table gives an overview of the characters determining the file type:
|
|
|
|
| **d**rwxrwxr-x 4 zeus zeus 4096 Οκτ 14 20:24 install
|
|
|
|
.File types in a long list
|
|
[options="header,footer"]
|
|
|=======================
|
|
|Symbol| Meaning
|
|
|-| Regular file
|
|
|d| Directory
|
|
|l| Link
|
|
|c| Special file
|
|
|s| Socket
|
|
|p| Named pipe
|
|
|b| Block device
|
|
|=======================
|
|
|
|
| -**rw-**rw-r-- 1 zeus zeus 1517 Οκτ 23 21:55 INSTALL.md
|
|
|
|
==== Access rights
|
|
|
|
.Access rights
|
|
[options="header,footer"]
|
|
|=======================
|
|
|Code| Meaning
|
|
|0 or -|The access right that is supposed to be on this place is not granted.
|
|
|4 or r|read access is granted to the user category defined in this place
|
|
|2 or w|write permission is granted to the user category defined in this place
|
|
|1 or x|execute permission is granted to the user category defined in this place
|
|
|=======================
|
|
|
|
|
|
==== User group codes
|
|
|
|
.User group codes
|
|
[options="header,footer"]
|
|
|=======================
|
|
|Code| Meaning|
|
|
|u| user permissions|-**rw-**rw-r--
|
|
|g| group permissions|-rw-**rw-**r--
|
|
|o| permissions for others|-rw-rw-**r--**
|
|
|=======================
|
|
|
|
|
|
==== Exercises
|
|
[source,bash]
|
|
----
|
|
touch example
|
|
chmod 400 example
|
|
ls -l example
|
|
chmod 500 example
|
|
ls -l example
|
|
chmod 600 example
|
|
ls -l example
|
|
chmod 644 example
|
|
ls -l example
|
|
chmod 660 example
|
|
ls -l example
|
|
chmod 700 example
|
|
ls -l example
|
|
chmod 755 example
|
|
ls -l example
|
|
chmod 775 example
|
|
ls -l example
|
|
ls -l example
|
|
chmod 777 example
|
|
ls -l example
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
|
|
== Linux file system layout
|
|
|
|
.Subdirectories of the root directory
|
|
[options="header,footer"]
|
|
|=======================
|
|
|Directory| Content
|
|
|/bin| Common programs, shared by the system, the system administrator and the users.
|
|
|/boot| The startup files and the kernel, vmlinuz. In some recent distributions also grub data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today.
|
|
|/dev| Contains references to all the CPU peripheral hardware, which are represented as files with special properties.
|
|
|/etc| Most important system configuration files are in /etc
|
|
|/home| Home directories of the common users.
|
|
|/lib| Library files, includes files for all kinds of programs needed by the system and the users.
|
|
|/mnt| Standard mount point for external file systems, e.g. a CD-ROM or a digital camera.
|
|
|/opt| Typically contains extra and third party software.
|
|
|/proc| A virtual file system containing information about system resources.
|
|
|/root| The administrative user's home directory. Mind the difference between /, the root directory and /root, the home directory of the root user.
|
|
|/sbin| Programs for use by the system and the system administrator.
|
|
|/tmp| Temporary space for use by the system, cleaned upon reboot, so don't use this for saving any work!
|
|
|/usr| Programs, libraries, documentation etc. for all user-related programs.
|
|
|/var| Storage for all variable files and temporary files created by users, such as log files, the mail queue, the print spooler area, space for temporary storage of files downloaded from the Internet, or to keep an image of a CD before burning it.
|
|
|=======================
|
|
|
|
|
|
|
|
== Find IP
|
|
|
|
[source,bash]
|
|
----
|
|
# ifconfig
|
|
|
|
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
|
inet 172.21.0.2 netmask 255.255.0.0 broadcast 172.21.255.255
|
|
ether 02:42:ac:15:00:02 txqueuelen 0 (Ethernet)
|
|
RX packets 61 bytes 9309 (9.3 KB)
|
|
RX errors 0 dropped 0 overruns 0 frame 0
|
|
TX packets 0 bytes 0 (0.0 B)
|
|
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
|
|
|
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
|
|
inet 127.0.0.1 netmask 255.0.0.0
|
|
loop txqueuelen 1000 (Local Loopback)
|
|
RX packets 248 bytes 14260 (14.2 KB)
|
|
RX errors 0 dropped 0 overruns 0 frame 0
|
|
TX packets 248 bytes 14260 (14.2 KB)
|
|
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
|
----
|
|
|
|
TIP: inet ***172.21.0.2*** netmask 255.255.0.0 broadcast 172.21.255.255
|
|
|
|
|
|
|
|
|
|
|
|
:hardbreaks:
|
|
|
|
{empty} +
|
|
{empty} +
|
|
{empty}
|
|
|
|
:!hardbreaks:
|
|
|
|
'''
|
|
|
|
.Reminder
|
|
[NOTE]
|
|
====
|
|
:hardbreaks:
|
|
Caminante, no hay camino,
|
|
se hace camino al andar.
|
|
|
|
Wanderer, there is no path,
|
|
the path is made by walking.
|
|
|
|
*Antonio Machado* Campos de Castilla
|
|
====
|
|
|