Linux Terminal Kurs Teil 3 - touch

2 months ago
8

#MiBaTech#MiBaHealthAndNutrition#MiBaFunAndGames

Willkommen zum dritten Teil meines Terminal-Kurses.

Heute wollen wir uns etwas genauer mit dem Befehl "ls" beschäftigen.
Der Befehl "ls" steht für "list files and directories" und zeigt euch an, was sich im jeweiligen Verzeichnis befindet.
Er kann auf verschiedene Weisen kombiniert werden.

touch <filename>
touch test1 test2
touch test{1..10}
touch test_{a..j}
stat filename

Die Informationen erhalten wir von stat

Im Folgenden finden Sie die Informationen, die wir über die Datei erhalten, wenn wir den Befehl stat ausführen.

Datei: Der Name der bereitgestellten Datei. Wenn es sich bei der bereitgestellten Datei um einen Symlink handelt, unterscheidet sich der Name.
Größe: Die Größe einer bestimmten Datei in Bytes.
Blöcke: Gesamtzahl der der Datei zugewiesenen Blöcke, die auf der Festplatte gespeichert werden sollen.
E/A-Block: Die Größe jedes zugewiesenen Blocks in Bytes.
Dateityp: Die Datei kann Folgendes sein: Normale Dateien, spezielle Dateien, Verzeichnisse oder symbolische Links.
Gerät: Gerätenummer im Hexadezimalformat.
Inode: Inode-Nummer der Datei.
Links: Anzahl der Hardlinks der Datei.
Zugriff: Zugriffsberechtigungen in den numerischen und symbolischen Methoden.
Kontext: Das Feld speichert den SELinux-Sicherheitskontext.
Zugriff: Der letzte Zeitpunkt, zu dem auf die Datei zugegriffen wurde.
Ändern: Der letzte Zeitpunkt, zu dem die Datei geändert wurde.
Änderung: Der letzte Zeitpunkt, an dem das Attribut oder der Inhalt der Datei geändert wurde.
Erstellt: Der Zeitpunkt, zu dem die Datei erstellt wurde.

https://youtu.be/lQBzXFcqH1M

File: The name of the provided file. If the provided file is a symlink, the name will differ.
Size: The size of a given file in Bytes.
Blocks: Total number of allocated blocks to the file to store on the hard disk.
IO Block: The size of every allocated block in bytes.
File type: The file may be of the following: Regular files, special files, directories, or symbolic links.
Device: Device number in hexadecimal format.
Inode: Inode number of the file.
Links: Number of hard links of the file.
Access: Access permissions in the numeric and symbolic methods.
Context: The field stores the SELinux security context.
Access: The last time at which the file was accessed.
Modify The last time at which the file was modified.
Change: The last time the at which file’s attribute or content was changed.
Birth: The time at which the file was created.
===============================================================================

Some of the options used with touch command are:

touch -a: change access time
touch -c: do not create files
touch -m: change modification time

touch -d <string> <filename> option to set a timestamp using a date string
touch -d tomorrow test

Change Access Time to Current

Use the -a tag to change a file's access time. The general syntax is:

touch -a <filename>

For example, to show a file's access time, run:

ls -lu

Next, change the access time for the file named test with:

touch -a test

Lastly, view the changed time by running:

ls -lu
===================================================================
touch -t <timestamp> <filename> Use specific time (instead of current time)
[[CC]YY]MMDDhhmm[.ss]
To break down this syntax, anything that is between the square brackets is optional. Below is what each cipher-like character stands for:
CC - the first two digits for a year
YY - the last two digits for a year
MM - the month
DD - the day
hh - the hour
mm - the minutes
ss - the seconds

touch -t 199901010000 test1
For example, to change the timestamp for a file called test to midnight January 1st, 1999, run:
==================================================================
Set File Timestamp Using Date String

The touch command uses the -d option to set a timestamp using a date string. The syntax is:

touch -d <string> <filename>

The date string is a flexible time format and accepts many different human-readable textual forms. Some examples include:

Calendar dates, such as 19 August 2020.
Time of day, such as 9:27pm or 8:02am.
Days of the week, such as Sunday, Monday, etc.
Relative time, such as 5 years ago, yesterday, next tuesday, etc.

For example, change the timestamp using the -d option to tomorrow:

================================
Playlist:
https://www.youtube.com/watch?v=uarQolcS5d8&list=PLq7y778vthUDlQdlLmzJPOJyLYXxBObzC&index=1

Timeline
0:46 df Befehl
1:38 du Befehl
3:10 free Befehl

Wenn euch das Video gefällt, würde ich mich über einen Like und ein Abo freuen. :)

MiBaTech,
stat, touch,touch -a,touch -t, Befehle, echo, cat, mkdir, rm, rmdir,
cp,mv,man,more,lees,sudo,chmod,top,htop,btop,which,whatis,version
Linux-Tutorials,dl,du,free
Ubuntu-Anleitung,
Linux-Befehle,
Linux-Grundlagen,
Linux-Distributionen
Linux-Installation,
Shell-Programmierung,
Open-Source-Software,
Linux-Anfänger,
Linux-Server-Konfiguration,
Terminal-Befehle,
Kommandozeilen-Tutorial,
Shell-Skripting,
Terminal-Tricks,
Befehlszeile für Anfänger,
Terminal-Fehlerbehebung,
Terminal-Hacks,
Linux-Kommandozeile,
Konsole verwenden,
Terminal-Shortcuts,
Audio- und Video-Bearbeitung,
Video schneiden,
Audio bearbeiten,
Videobearbeitungssoftware,
Tonmischung,
Videoeffekte,
Filmbearbeitung,
Videoproduktionstipps,
Audioaufnahme-Tutorial,
Video-Rendering,
Color Grading

Loading comments...