Soluții

How to Leave a Discord Server

If you’re no longer interested in being part of a Discord server, you can leave the server to stop further engaging with it. We’ll show you how to do this in Discord on desktop, web, and mobile. When you leave a server, Discord no longer sends you notifications from that server. You also can’t post any messages in that server, and it will disappear from your sidebar.

[mai mult...]

How to install ncdu on Linux / Unix to see disk usage

The du (disk usage) command summarizes directory trees’ sizes, including all of their contents and individual files’ sizes on Linux and Unix-like systems such as macOS. It helps track down space hogs. In other words, we can list directories and files that consume large amounts of space on a hard disk drive. Let us see the ncdu command, a curses-based version of the well-known du command.

Installing ncdu on Linux

Open the Terminal application and then type commands as per your distro. For instances, Debian/Ubuntu Linux users try the apt command/apt-get command as follows:
sudo apt install ncdu

Alpine Linux install ncdu

Try the apk command to install ncdu including man pages on Alpine Linux:
# apk add ncdu ncdu-doc

Arch Linux install ncdu

Use the pacman command:
sudo pacman -S ncdu

OpenSUSE/SUSE Linux

We use the zypper command:
sudo zypper in ncdu

CentOS/RHEL/Fedora Linux

Turn on EPLE repo for RHEL/CentOS and then run the yum command:
sudo yum install ncdu
Fedora Linux user simply run the dnf command:
sudo dnf install ncdu

macOS install ncdu

First, install Homebrew on macOS to use the brew package manager and then type:
brew install ncdu
Or use the following when using macports:
sudo port install ncdu

FreeBSD Unix install ncdu

Type the following pkg command:
sudo pkg install ncdu

OpenBSD installing ncdu

Execute the pkg_add command:
doas pkg_add ncdu

How to use the ncdu command

The basic syntax for ncdu is:
ncdu
ncdu [options] [directories]

Press q to exit to the shell. The ncdu can give information about any directory trees. For example:
ncdu /etc/
ncdu /tmp/
ncdu /nfs
ncdu $HOME

Options

We can enable extended information mode by passing the -e:
ncdu -e
When ou want to scan a full filesystem, your root filesystem, for example, then you’ll want to pass the -x:
sudo ncdu -x /
On large Unix and Linux file servers, scanning a whole directory may take a while. So what you can do is review a directory and export the results for later viewing:
sudo ncdu -1xo- / | gzip >my_root_export.gz
Later after some time, we can use zcommands to read gzip compressed text files on a fly and pipe it out to the ncdu as follows:
ls -l my_root_export.gz
zcat my_root_export.gz | ncdu -f-

The -f option load the given file, which has earlier been created with the -o option. If FILE is equivalent to -, the file is read from standard input (pipe).
It is also possible to scan a system remotely using the ssh command. Then browse through the files locally:
ssh -C user@system ncdu -o- / | ncdu -f-
ssh -C vivek@192.168.2.17 ncdu -o- / | ncdu -f-

Turn on color option:
ncdu --color dark
ncdu --color dark -x /

We can exclude files that match PATTERN:
ncdu --exclude '*.c'
ncdu -x --exclude '/dir1' --exclude '/dir2' /

Follow symlinks and count the size of the file they point to:
ncdu -L
ncdu -L dir1

Keyboard shortcuts
Always press ? to get help about keys
Key Description
upk Move cursor up
downj Move cursor down
right/enter Open selected directory
left<h Open parent directory
n Sort by name (ascending/descending)
s Sort by size (ascending/descending)
C Sort by items (ascending/descending
M Sort by mtime (-e flag)
d Delete selected file or directory
t Toggle dirs before files when sorting
g Show percentage and/or graph
a Toggle between apparent size and disk usage
c Toggle display of child item counts
m Toggle display of latest mtime (-e flag)
e Show/hide hidden or excluded files
i Show information about selected item
r Recalculate the current directory
b Spawn shell in current directory
q Quit ncdu
[mai mult...]