Linuxhotel Wiki

Wie ging das nochmal?

Benutzer-Werkzeuge

Webseiten-Werkzeuge


lpi1:befehle

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu der Vergleichsansicht

lpi1:befehle [2018/08/08 17:45]
lpi1:befehle [2024/01/09 09:35] (aktuell)
Zeile 1: Zeile 1:
 +====== Befehle für Verzeichnisse ======
 +|mkdir ''​Verzeichnis'' ​                   | ''​Verzeichnis''​ **anlegen** |
 +|mkdir -p ''​Verzeichnis/​Unterverzeichnis'' ​ | ''​Unterverzeichnis''​ inkl. ''​Verzeichnis''​ **anlegen** |
 +|cd                 | ins Heimatverzeichnis **wechseln** |
 +|cd ''​Verzeichnis''​ | in ''​Verzeichnis''​ **wechseln** |
 +|cd -               | in vorheriges Verzeichnis zurück **wechseln** |
 +|cd /               | ins oberste Verzeichnis **wechseln** |
 +|cd ..              | ein Verzeichnis nach oben **wechseln** |
 +|ls      | Verzeichnisinhalt **anzeigen** (nur Namen)|
 +|ls -i   | Verzeichnisinhalt inkl. [[wpde>​Inode|Inodenummer]] |
 +|ls -a   | Verzeichnisinhalt inkl. versteckte Dateien (.Dateien)((
 +Kommentar dazu von [[wpde>​Rob Pike]] am 03.08.2012 ​
 +
 +Long ago, as the design of the Unix file system was being worked out, the entries . and .. appeared, to make navigation easier. I'm not sure but I believe .. went in during the Version 2 rewrite, when the file system became hierarchical (it had a very different structure early on).  When one typed ls, however, these files appeared, so either Ken or Dennis added a simple test to the program. It was in assembler then, but the code in question was equivalent to something like this:
 +<code c>
 +   if (name[0] == '​.'​) continue;
 +</​code>​
 +This statement was a little shorter than what it should have been, which is
 +<code c>
 +   if (strcmp(name,​ "​."​) == 0 || strcmp(name,​ "​.."​) == 0) continue;
 +</​code>​
 +but hey, it was easy.
 +
 +Two things resulted.
 +
 +First, a bad precedent was set. A lot of other lazy programmers introduced bugs by making the same simplification. Actual files beginning with periods are often skipped when they should be counted.
 +
 +Second, and much worse, the idea of a "​hidden"​ or "​dot"​ file was created. As a consequence,​ more lazy programmers started dropping files into everyone'​s home directory. I don't have all that much stuff installed on the machine I'm using to type this, but my home directory has about a hundred dot files and I don't even know what most of them are or whether they'​re still needed. Every file name evaluation that goes through my home directory is slowed down by this accumulated sludge.
 +
 +I'm pretty sure the concept of a hidden file was an unintended consequence. It was certainly a mistake.
 +
 +How many bugs and wasted CPU cycles and instances of human frustration (not to mention bad design) have resulted from that one small shortcut about  40 years ago?
 +
 +Keep that in mind next time you want to cut a corner in your code.
 +
 +(For those who object that dot files serve a purpose, I don't dispute that but counter that it's the files that serve the purpose, not the convention for their names. They could just as easily be in $HOME/cfg or $HOME/lib, which is what we did in Plan 9, which had no dot files. Lessons can be learned.)
 +----
 +Quelle: https://​plus.google.com/​+RobPikeTheHuman/​posts/​R58WgWwN9jp)) **anzeigen** |
 +|ls -l   | Verzeichnisinhalt inkl. Rechte, Größe und Zeit **anzeigen** |
 +|ls -ld  | Verzeichnis selbst inkl. Rechte, Größe und Zeit **anzeigen** |
 +|ls -lrt | Verzeichnis inkl. Rechte, Größe und Zeit **anzeigen**,​ sortiert nach zuletzt geänderten Dateien|
 +|cp ''​Quelle''​ ''​Ziel'' ​     | Datei ''​Quelle''​ in Verzeichnis ''​Ziel''​ oder in Datei ''​Ziel''​ **kopieren** |
 +|cp ''​Quelle1''​ ''​Quelle2''​ ... ''​Zielverzeichnis'' ​    | Dateien ''​QuelleN''​ in Verzeichnis ''​Ziel''​ **kopieren** |
 +|cp -a ''​Quelle''​ ''​Ziel'' ​  | Verzeichnis ''​Quelle''​ inkl. Inhalt ins Verzeichnis ''​Ziel''​ **kopieren**,​ Rechte und Symlinks beibehalten |
 +|cp -a ''​Quelle/​.''​ ''​Ziel''​ | Verzeichnisinhalt von ''​Quelle''​ ins Verzeichnis ''​Ziel''​ **kopieren**,​ Rechte und Symlinks beibehalten |
 +|mv ''​Quelle''​ ''​Ziel''​ | ''​Quelle''​ in ''​Ziel''​ umbenennen oder nach Verzeichnis ''​Ziel''​ verschieben |
 +|rmdir ''​Verzeichnis''​|leeres ''​Verzeichnis''​ löschen|
 +|rm -r ''​Verzeichnis''​|''​Verzeichnis''​ inkl. Inhalt löschen|
 +
 +
 +====== Befehle für Dateien ======
 +|touch ''​Datei''​ | ''​Datei''​ anlegen, eigentlich: **Datumsstempel** ändern |
 +|''>​ Datei'' ​    | ''​Datei''​ anlegen, bestehende Datei leeren ​ |
 +|ls -l ''​Datei''​ | ''​Datei''​ inkl. Rechte, Größe und Zeit **anzeigen** |
 +|cp ''​Quelle''​ ''​Ziel'' ​     | ''​Quelle''​ in Verzeichnis ''​Ziel''​ oder in Datei ''​Ziel''​ **kopieren** |
 +|mv ''​Quelle''​ ''​Ziel''​ | ''​Quelle''​ in ''​Ziel''​ **umbenennen** oder nach Verzeichnis ''​Ziel''​ **verschieben** |
 +|rm ''​Datei''​ | ''​Datei''​ **löschen** |
 +|cat ''​Datei''​ | Inhalt von ''​Datei''​ **ausgeben**,​ geht auch mit mehreren Dateien|
 +|[[less]] ''​Datei''​ | Inhalt von ''​Datei''​ **betrachten**,​ kann blättern suchen usw. Hilfe mit h, beenden mit q |
 +|vi ''​Datei''​ | Inhalt von ''​Datei''​ **bearbeiten** (dazu gibt es ein [[vim|eigenes Kapitel]]) |
 +|pwd    | Aktuelles Arbeitsverzeichnis|
 +
 +
 +
 +
 +
 +
  
lpi1/befehle.txt · Zuletzt geändert: 2024/01/09 09:35 (Externe Bearbeitung)