Manjaro Difference between revisions of "CheatSheet"

Difference between revisions of "CheatSheet"

From Manjaro
(Files)
(Marked this version for translation)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
<languages/>
<translate>
<!-- Example titles -->
<!-- Example titles -->
== CheatSheet for Manjaro ==
= Commands CheatSheet for Manjaro = <!--T:1-->
The original startet with a thread at https://forum.manjaro.org/t/manjaro-cli-cheat-sheet/101305/3


<!--T:2-->
<!-- TOC shows contents of the page -->
<!-- TOC shows contents of the page -->
__TOC__
__TOC__


=== Locating and Installing Packages ===
=== Locating and Installing Packages === <!--T:3-->
 
==== Using Pamac CLI ====
Update mirrorlist with the fastest mirrors {{UserCmd|command=sudo pacman-mirrors --fasttrack && sudo pacman -Syyu}}
{{RootCmd|command=pacman-mirrors --fasttrack && pacman -Syyu}}
Check if updates are available {{UserCmd|command=pamac checkupdates -a}}
Update all installed packages {{UserCmd|command=pamac upgrade -a}}
Search available packages {{UserCmd|command=pamac search [PackageName]}}
Install packages {{UserCmd|command=pamac install [PackageName]}}
Install packages {{UserCmd|command=pamac install [PackageName]}}
Uninstall packages {{UserCmd|command=pamac remove [PackageName]}}
Uninstall packages {{UserCmd|command=pamac remove [PackageName]}}
Search for a package {{UserCmd|command=pamac search [PackageName]}}
Update installed packages {{UserCmd|command=pamac upgrade}}
Check for updates {{UserCmd|command=pamac checkupdates}}


=== Maintenance ===
==== Using native pacman ==== <!--T:26-->
Install packages {{UserCmd|command=sudo pacman -Syu [PackageName]}}
Uninstall packages {{UserCmd|command=sudo pacman -Rns [PackageName]}}
Search for a package {{UserCmd|command=pacman -Ss [PackageName]}}
Update installed packages {{UserCmd|command=sudo pacman -Syu}}
Check for updates {{UserCmd|command=sudo pacman -Syu}}
 
=== Maintenance === <!--T:5-->
 
<!--T:6-->
Generates  a  random  mirrorlist for the users and sort them by their current access time. {{UserCmd|command=sudo pacman-mirrors --fasttrack}}
Generate cache list {{UserCmd|command=du -sh ~/.cache/*}}
Generate cache list {{UserCmd|command=du -sh ~/.cache/*}}
Purge files not accessed in 100 days {{UserCmd|command=find ~/.cache/ -type f -atime +100 -delete}}
Purge files not accessed in 100 days {{UserCmd|command=find ~/.cache/ -type f -atime +100 -delete}}
Line 26: Line 35:
Remove all packages except the latest 3 versions {{UserCmd|command=pamac clean --keep 3}}
Remove all packages except the latest 3 versions {{UserCmd|command=pamac clean --keep 3}}


=== AUR ===
=== AUR === <!--T:7-->
Search for packages {{UserCmd|command=pamac search -a [PackageName]}}
 
Build the package{{UserCmd|command=pamac build [PackageName]}}
<!--T:8-->
Search for package {{UserCmd|command=pamac search -a [PackageName]}}
Build the package {{UserCmd|command=pamac build [PackageName]}}
 
=== Access rights === <!--T:9-->


=== Access rights ===
<!--T:10-->
Executes command as root {{UserCmd|command=sudo [command]}}
Execute command as root {{UserCmd|command=sudo [command]}}
Empties password cache {{UserCmd|command=sudo -k}}
Empty password cache {{UserCmd|command=sudo -k}}
Edits /etc/sudoers {{UserCmd|command=sudo visudo}}
Change user password {{UserCmd|command=passwd username}}
Changes user password {{UserCmd|command=passwd}}
Change owner and group of file {{UserCmd|command=chown [owner]:[group] -c [file]}}
Changes owner and group of file {{UserCmd|command=chown [owner]:[group] -c [file]}}
Change file permissions {{UserCmd|command=chmod [permissions] -c [file]}}
Changes the file permissions {{UserCmd|command=chmod [permissions] -c [file]}}
Set permissions in octal mode: 4(read) 2(write) 1(execute)
Set permissions in octal mode: 4(read) 2(write) 1(execute)


<!--T:11-->
Example: 755 read-write-execute for owner and read-execute for group and others
Example: 755 read-write-execute for owner and read-execute for group and others


Displays files and permissions [of directory]{{UserCmd|command=ls -lh [dir]}}
<!--T:12-->
Display files and permissions [of directory]{{UserCmd|command=ls -lh [dir]}}


=== Files and Directories ===
=== Files and Directories === <!--T:13-->
changes the working directory {{UserCmd|command=cd [dir]}}
changes to the parent directory {{UserCmd|command=cd ..}}
lists directory contents {{UserCmd|command=ls -l}}
also lists the hidden files {{UserCmd|command=ls -la}}
copies the file {{UserCmd|command=cp [file] [target]}}
copies the directory {{UserCmd|command=cp -r [directory] [target]}}
move/rename target source {{UserCmd|command=mv [source] [target]}}
removes directory '''recursively''' {{UserCmd|command=rm -r [dir]}}
create symbolic link {{UserCmd|command=ln -s [target] [link]}}
mounts file system {{UserCmd|command=mount -t [type] [/dev/sdx9] [mountpoint]}}
mounts iso image {{UserCmd|command=mount -o loop [iso] [mountpoint]}}
home directory of user {{UserCmd|command=cd /home/$USER}} {{UserCmd|command=cd ~}}
directory with global configurations {{UserCmd|command=cd /etc}}


=== Your sub title ===
<!--T:14-->
=== Your sub title ===
Change the working directory {{UserCmd|command=cd [dir]}}
=== Your sub title ===
Change to parent directory {{UserCmd|command=cd ..}}
=== Your sub title ===
List directory contents {{UserCmd|command=ls -l}}
=== Your sub title ===
List also hidden files {{UserCmd|command=ls -la}}
=== Your sub title ===
Copy file {{UserCmd|command=cp [file] [target]}}
Copy directory '''recursively''' {{UserCmd|command=cp -r [directory] [target]}}
Move or rename file/directory {{UserCmd|command=mv [source] [target]}}
Remove directory '''recursively''' {{UserCmd|command=rm -r [dir]}}
Create symbolic link {{UserCmd|command=ln -s [target] [link]}}
Mount filesystem {{UserCmd|command=mount -t [type] [/dev/sdx9] [mountpoint]}}
Mount ISO image {{UserCmd|command=mount -o loop [iso] [mountpoint]}}
Home directory of user {{UserCmd|command=cd /home/$USER}} {{UserCmd|command=cd ~}}
Directory with global configurations {{UserCmd|command=cd /etc}}


==== Your sub title 2 ====
=== Network === <!--T:15-->


<!-- More Detail for formatter: https://www.mediawiki.org/wiki/Help:Formatting -->
<!--T:16-->
Display network information {{UserCmd|command=nmcli}}
List wireless access points {{UserCmd|command=nmcli c}}
Enable firewall [package Community: ufw]  {{UserCmd|command=ufw enable}}
Allow/deny all incoming traffic {{UserCmd|command=ufw default [allow/deny]}}
Displays firewall status and rules {{UserCmd|command=ufw status}}
Allows/deny incoming traffic on the specified port {{UserCmd|command=ufw [allow/deny] [port]}}
Allows/deny incoming traffic from specified IP address {{UserCmd|command=ufw [allow/deny] from [ip]}}


<!-- If you use command, it should be inside of usercmd. You can see below example -->
=== System and Screen === <!--T:17-->


{{UserCmd|command=example command should be here}}
<!--T:18-->
Display kernel version {{UserCmd|command=uname -r}}
Display long kernel version {{UserCmd|command=uname -a}}
Report file system disk space usage {{UserCmd|command=df [/] [/home]}}  {{UserCmd|command=sudo btrfs filesystem usage -h [/]}}
Display system tasks  {{UserCmd|command=top}}  {{UserCmd|command=htop}}
Display system information {{UserCmd|command=inxi --admin --verbosity=7 --filter --width}}
Display a tree of processes  {{UserCmd|command=pstree}}


<!-- If you use code, it should be like below example(a space before that) -->
<!--T:19-->
Switch to tty 
* {{key press|Ctrl|Alt|F1}}
* {{key press|Ctrl|Alt|F2}}
* {{key press|Ctrl|Alt|F3}}
* {{key press|Ctrl|Alt|F4}}
* {{key press|Ctrl|Alt|F5}}
* {{key press|Ctrl|Alt|F6}}


Example codes should be here.
<!--T:20-->
Switch to the X session
* {{key press|Ctrl|Alt|F7}}


<!-- Don't forget to look more templates: https://wiki.manjaro.org/index.php/Help:Template -->
<!--T:21-->
Start a unit {{UserCmd|command=systemctl start unit}}
Stop a unit {{UserCmd|command=systemctl stop unit}}
Check status of a unit {{UserCmd|command=systemctl status unit}}
Enable a unit {{UserCmd|command=systemctl enable unit}}
Disable a unit {{UserCmd|command=systemctl disable unit}}
Restart a unit {{UserCmd|command=systemctl restart unit}}
Shut down the system {{UserCmd|command=poweroff}}
Restart the system {{UserCmd|command=reboot}}


=See Also=
<!--T:22-->
<!-- More Detail for formatter: https://www.mediawiki.org/wiki/Help:Formatting -->


[https://example.link Example Link Title] example text
<!--T:23-->
<!-- Don't forget to look more templates: https://wiki.manjaro.org/index.php/Help:Template -->


=See Also= <!--T:24-->


<!--T:25-->
[https://forum.manjaro.org/t/manjaro-cli-cheat-sheet/101305 Original forum post]
</translate>
<!--Category or categories should have a translation extension below example-->
<!--Category or categories should have a translation extension below example-->
[[Category:Boilerplate{{#translation:}}]]
[[Category:Boilerplate{{#translation:}}]]

Latest revision as of 07:42, 11 December 2023

Other languages:
Deutsch • ‎English • ‎Türkçe • ‎русский

Commands CheatSheet for Manjaro

Locating and Installing Packages

Using Pamac CLI

Install packages

user $ pamac install [PackageName] COPY TO CLIPBOARD


Uninstall packages

user $ pamac remove [PackageName] COPY TO CLIPBOARD


Search for a package

user $ pamac search [PackageName] COPY TO CLIPBOARD


Update installed packages

user $ pamac upgrade COPY TO CLIPBOARD


Check for updates

user $ pamac checkupdates COPY TO CLIPBOARD


Using native pacman

Install packages

user $ sudo pacman -Syu [PackageName] COPY TO CLIPBOARD


Uninstall packages

user $ sudo pacman -Rns [PackageName] COPY TO CLIPBOARD


Search for a package

user $ pacman -Ss [PackageName] COPY TO CLIPBOARD


Update installed packages

user $ sudo pacman -Syu COPY TO CLIPBOARD


Check for updates

user $ sudo pacman -Syu COPY TO CLIPBOARD


Maintenance

Generates a random mirrorlist for the users and sort them by their current access time.

user $ sudo pacman-mirrors --fasttrack COPY TO CLIPBOARD


Generate cache list

user $ du -sh ~/.cache/* COPY TO CLIPBOARD


Purge files not accessed in 100 days

user $ find ~/.cache/ -type f -atime +100 -delete COPY TO CLIPBOARD


Report journal current size

user $ journalctl --disk-usage COPY TO CLIPBOARD


Remove but recent entries by size or time

user $ journalctl --vacuum-size=50M COPY TO CLIPBOARD


user $ journalctl --vacuum-time=2weeks COPY TO CLIPBOARD


Check for orphaned packages

user $ pamac list -o COPY TO CLIPBOARD


Remove all orphans

user $ pamac remove -o COPY TO CLIPBOARD


Remove all packages except the latest 3 versions

user $ pamac clean --keep 3 COPY TO CLIPBOARD


AUR

Search for package

user $ pamac search -a [PackageName] COPY TO CLIPBOARD


Build the package

user $ pamac build [PackageName] COPY TO CLIPBOARD


Access rights

Execute command as root

user $ sudo [command] COPY TO CLIPBOARD


Empty password cache

user $ sudo -k COPY TO CLIPBOARD


Change user password

user $ passwd username COPY TO CLIPBOARD


Change owner and group of file

user $ chown [owner]:[group] -c [file] COPY TO CLIPBOARD


Change file permissions

user $ chmod [permissions] -c [file] COPY TO CLIPBOARD


Set permissions in octal mode: 4(read) 2(write) 1(execute)

Example: 755 read-write-execute for owner and read-execute for group and others

Display files and permissions [of directory]

user $ ls -lh [dir] COPY TO CLIPBOARD


Files and Directories

Change the working directory

user $ cd [dir] COPY TO CLIPBOARD


Change to parent directory

user $ cd .. COPY TO CLIPBOARD


List directory contents

user $ ls -l COPY TO CLIPBOARD


List also hidden files

user $ ls -la COPY TO CLIPBOARD


Copy file

user $ cp [file] [target] COPY TO CLIPBOARD


Copy directory recursively

user $ cp -r [directory] [target] COPY TO CLIPBOARD


Move or rename file/directory

user $ mv [source] [target] COPY TO CLIPBOARD


Remove directory recursively

user $ rm -r [dir] COPY TO CLIPBOARD


Create symbolic link

user $ ln -s [target] [link] COPY TO CLIPBOARD


Mount filesystem

user $ mount -t [type] [/dev/sdx9] [mountpoint] COPY TO CLIPBOARD


Mount ISO image

user $ mount -o loop [iso] [mountpoint] COPY TO CLIPBOARD


Home directory of user

user $ cd /home/$USER COPY TO CLIPBOARD


user $ cd ~ COPY TO CLIPBOARD


Directory with global configurations

user $ cd /etc COPY TO CLIPBOARD


Network

Display network information

user $ nmcli COPY TO CLIPBOARD


List wireless access points

user $ nmcli c COPY TO CLIPBOARD


Enable firewall [package Community: ufw]

user $ ufw enable COPY TO CLIPBOARD


Allow/deny all incoming traffic

user $ ufw default [allow/deny] COPY TO CLIPBOARD


Displays firewall status and rules

user $ ufw status COPY TO CLIPBOARD


Allows/deny incoming traffic on the specified port

user $ ufw [allow/deny] [port] COPY TO CLIPBOARD


Allows/deny incoming traffic from specified IP address

user $ ufw [allow/deny] from [ip] COPY TO CLIPBOARD


System and Screen

Display kernel version

user $ uname -r COPY TO CLIPBOARD


Display long kernel version

user $ uname -a COPY TO CLIPBOARD


Report file system disk space usage

user $ df [/] [/home] COPY TO CLIPBOARD


user $ sudo btrfs filesystem usage -h [/] COPY TO CLIPBOARD


Display system tasks

user $ top COPY TO CLIPBOARD


user $ htop COPY TO CLIPBOARD


Display system information

user $ inxi --admin --verbosity=7 --filter --width COPY TO CLIPBOARD


Display a tree of processes

user $ pstree COPY TO CLIPBOARD


Switch to tty

  • Ctrl+Alt+F1
  • Ctrl+Alt+F2
  • Ctrl+Alt+F3
  • Ctrl+Alt+F4
  • Ctrl+Alt+F5
  • Ctrl+Alt+F6

Switch to the X session

  • Ctrl+Alt+F7

Start a unit

user $ systemctl start unit COPY TO CLIPBOARD


Stop a unit

user $ systemctl stop unit COPY TO CLIPBOARD


Check status of a unit

user $ systemctl status unit COPY TO CLIPBOARD


Enable a unit

user $ systemctl enable unit COPY TO CLIPBOARD


Disable a unit

user $ systemctl disable unit COPY TO CLIPBOARD


Restart a unit

user $ systemctl restart unit COPY TO CLIPBOARD


Shut down the system

user $ poweroff COPY TO CLIPBOARD


Restart the system

user $ reboot COPY TO CLIPBOARD



See Also

Original forum post

Cookies help us deliver our services. By using our services, you agree to our use of cookies.