+5 votes
85 views
Mac: Terminal commands for easier work

in macOS by (552k points)
reopened | 85 views

1 Answer

+3 votes
Best answer

The basic operation of the terminal
Helpful terminal commands

We'll show you the commands you can use to save yourself additional work steps in the Mac terminal..

image image

Those who are familiar with the Mac terminal often shy away from the surface reduced to text and fear that they might have to program right away. But don't worry: commands for the text-based user interface are understandable even without in-depth IT knowledge and lead to improved work on your Mac. We'll show you how to use Terminal commands.

The basic operation of the terminal

After launching Terminal on your Mac, you'll only see the Mac's name. You can start entering commands. To delete a line immediately, you can use the key combination [Ctrl] + [K] . It is also possible to jump either with [Ctrl] + [A] to the beginning of a line or with [Ctrl] + [E] to jump to the end of a line. Using the arrow keys up and down , you can switch back and forth between the individual commands.

image

To find out the current directory you are in at this point in time, type " pwd " and then press Enter . Terminal then delivers the complete path. There are shortcuts for folders that you change frequently to speed up the writing process. The root directory of the hard disk is shown with a slash , for example , the tilde - generated by the key combination [Alt] + [N] - brings you to your home directory . How you can then switch to subfolders and which other useful commands are available can be read in the following section..

Helpful terminal commands

command description example
CD Change Directory - changes to a subfolder cd directory
Example: cd / Users / Documents / ...

Directories (called "directory" in Terminal) are separated by a "/".
pwd Print Working Directory - shows the current directory pwd directory
ls List - shows the contents of a folder ls directory
example: ls -a also shows invisible files
cp Copy - copies file cp path / source folder path / target folder
Example: cp ~ / Documents / Artikel.txt ~ / Desktop / Pay

attention to the path to the source folder (in the example "~ / Documents /") and the path to the target folder (in the example "~ / Desktop / "). The same applies to the move command.
mv Move - moves a file mv path / source folder path / target folder
Example: mv ~ / Documents / Article.txt ~ / Desktop /
rm Remove - deletes files. Differentiation between folders and files. File: rm Path / File
Example: rm ~ / Documents / Article.text

Folder: rmdir -R ~ / Documents / Delete
Example: rmdir -R ~ / Documents / Delete
mkdir Make Directory - creates a new folder mkdir "folder name "
Example: mkdir " new folder "
kill Terminates the specified process kill process name
example: kill cp ~ / Documents / Article.txt ~ / Desktop /
see below Switch User - switches to the specified user su username
example: su admin
Wildcards apply single terminal commands to multiple files Any character string: *
Example: mv * .png ./PNGs (moves all files with the extension .png to the PNGs folder)

Any single character:?
Example: mv? .Png ./PNGs (only file names with exactly one character as the file name are moved to the PNGs folder)
wer bin ich Display of the current user wer bin ich
date Display of the current date date
screencapture Creates a screenshot screencapture
find Search function for files find / directory / filename
Example: find / home / picture1.jpeg
what is Brief information about the specified command what is
command description example
CD Change Directory - changes to a subfolder cd directory
Example: cd / Users / Documents / ...

Directories (called "directory" in Terminal) are separated by a "/".
pwd Print Working Directory - shows the current directory pwd directory
ls List - shows the contents of a folder ls directory
example: ls -a also shows invisible files
cp Copy - copies file cp Pfad/Quellordner Pfad/Zielordner
Beispiel: cp ~/Documents/Artikel.txt ~/Desktop/

Achten Sie darauf den Pfad zum Quellordner (im Beispiel "~/Documents/") und den Pfad zum Ziel-Ordner (im Beispiel "~/Desktop/") anzugeben. Das Gleiche gilt auch für den Move-Befehl.
mv Move - verschiebt eine Datei mv Pfad/Quellordner Pfad/Zielordner
Beispiel: mv ~/Documents/Artikel.txt ~/Desktop/
rm Remove - löscht Dateien. Unterscheidung zwischen Ordnern und Dateien. Datei: rm Pfad/Datei
Beispiel: rm ~/Documents/Artikel.text

Ordner: rmdir -R ~/Documents/Löschen
Beispiel: rmdir -R ~/Documents/Löschen
mkdir Make Directory - erzeugt einen neuen Ordner mkdir "Ordnerbezeichnung "
Beispiel: mkdir "NeuerOrdner "
kill Beendert den angegebenen Prozesse kill Prozessname
Beispiel: kill cp ~/Documents/Artikel.txt ~/Desktop/
su Switch User - wechselt zum angegebenen Benutzer su Benutzername
Beispiel: su Admin
Wildcards einzelne Terminal-Befehle auf mehrere Dateien anwenden Beliebige Zeichenkette: *
Beispiel: mv *.png ./PNGs (verschiebt alle Dateien mit der Endung .png in den Ordner PNGs)

Einzelnes beliebiges Zeichen: ?
Beispiel: mv ?.png ./PNGs (nur Dateinamen mit exakt einem Zeichen als Dateiname werden in den Ordner PNGs verschoben)
whoami Anzeige des aktuellen Benutzers whoami
date Anzeige des aktuellen Datums date
screencapture Erzeugt Screenshot screencapture
find Suchfunktion für Dateien find /Verzeichnis/Dateiname
Beispiel: find/home/bild1.jpeg
whatis Kurzinfo zum angegebenen Befehl whatis

Tip: We have summarized helpful shortcuts on the Mac for you here.


by (3.5m points)

Related questions

+3 votes
1 answer
asked Jan 1, 2022 in macOS by backtothefuture (552k points) | 80 views
+4 votes
1 answer
asked Jun 23, 2020 in Mac by backtothefuture (552k points) | 733 views
+4 votes
1 answer
asked Dec 28, 2021 in macOS by backtothefuture (552k points) | 90 views
+4 votes
1 answer
asked Jan 1, 2022 in macOS by backtothefuture (552k points) | 148 views
+4 votes
1 answer
asked Dec 25, 2021 in macOS by backtothefuture (552k points) | 94 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users