General
- arch
- chsh – Change Linux user shell
- apropos
- whois
- uname
- chown
- at
- lynx
- setfacl
- tr
- gifsicle
- chattr
- chmod
System
Networking
nmtui – configure networking
Disk/Storage
blkid – show UUID for disks.
vgcreate
# strace -p 17723 -bash: strace: command not found #
This is because strace not installed on the server. Install it with yum
# yum install strace Loading "installonlyn" plugin Setting up Install Process Setting up repositories Reading repository metadata in from local files Parsing package install arguments Resolving Dependencies --> Populating transaction set with selected packages. Please wait. ---> Downloading header for strace to pack into transaction set. strace-4.5.16-1.el5.1.i38 100% |=========================| 15 kB 00:00 ---> Package strace.i386 0:4.5.16-1.el5.1 set to be updated --> Running transaction check Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: strace i386 4.5.16-1.el5.1 base 163 k Transaction Summary ============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 163 k Is this ok [y/N]: y Downloading Packages: (1/1): strace-4.5.16-1.el 100% |=========================| 163 kB 00:00 Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: strace ######################### [1/1] Installed: strace.i386 0:4.5.16-1.el5.1 Complete! #
strace command is used to trace system calls. This is useful to see what a process is doing.
To see what a process doing, run
strace -p PID_HERE
To run a command and strace
strace cat 1.txt
Debug apache start up
strace -Ff -o output.txt -e open /etc/init.d/httpd restart cat output.txt | grep '= -1'
This script configure MariaDB repository on your server. You can find more details on offical page
https://mariadb.com/kb/en/library/mariadb-package-repository-setup-and-usage/
To setup mariadb repo, run
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
I was expecting it ask me what version of MariaDB i like to setup. But it just setup MariaDB 10.4. I wanted to upgrade MariaDB to version 10.2, anyway i did upgrade to 10.4 and everything worked fine.
If you need a speicfic version, you can run like
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.3"
Availabe versions are
mariadb-5.5 mariadb-10.0 mariadb-10.1 mariadb-10.2 mariadb-10.3 mariadb-10.4
When i run the script on Debian 9 server, i get following error
root@server:~# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash [info] Repository file successfully written to /etc/apt/sources.list.d/mariadb.list [info] Adding trusted package signing keys... Executing: /tmp/apt-key-gpghome.TKjSzTY6ww/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x8167EE24 0xE3C94F49 0xcbcb082a1bb943db 0xF1656F24C74CD1D8 0x135659e928c12247 gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory gpg: connecting dirmngr at '/run/user/0/gnupg/d.3y8gtbm7kaj8h4royj6yoyug/S.dirmngr' failed: No such file or directory gpg: keyserver receive failed: No dirmngr [error] Failed to add trusted package signing keys. root@server:~#
This is fixed by running
apt -y install dirmngr
To enable remote desktop on Ubuntu 18.04 (works with newer Ubuntu versions), go to settings.
Click on Sharing
Click on ON/OFF button on title bar to enable Desktop Sharing. Once enabled, click on “Screen Sharing” to See Desktop sharing option, you need to enable it for network connection.
Ubuntu use vino package to allow remote desktop over VNC.
See Ubuntu, VNC, remote desktop
iftop allow you to monitor network traffic like top command. You can download iftop source from
http://www.ex-parrot.com/~pdw/iftop/
Before installing, install required packages
yum -y install libpcap libpcap-devel
To install iftop, run
cd /usr/local/src wget http://www.ex-parrot.com/~pdw/iftop/download/iftop-0.17.tar.gz tar xvf iftop-0.17.tar.gz cd iftop-0.17 ./configure --prefix=/usr/local make make install
To run iftop, type
iftop
See iftop
When installing a software from source, i get error
configure: error: can't find pcap.h You're not going to get very far without libpcap.
To fix this on CentOS 7 server, run
yum -y install libpcap libpcap-devel
adduser command like useradd, used to add a user to linux server.
adduser is more interactive, while useradd require all options passed using command line options.
adduser [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--firstuid ID] [--lastuid ID] [--ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--gecos GECOS] [--add_extra_groups] user
For creating system user, run
adduser --system [options] [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID] [--group | --ingroup GROUP | --gid ID] [--disabled-password] [--disabled-login] [--gecos GECOS] user
To add a user, run
useradd USERNAME_HERE
To delete a user, run
deladd USERNAME_HERE
To scan a folder, run
clamscan -r /path/to/folder/
-r will scan sub folders too.
To Scan a Folder (Only Show Infected)
clamscan -ri /path/to/folder/
To exclude a folder from search, use
clamscan -ri --exclude-dir="^/opt/zimbra/store" /opt/zimbra/
See clamav
clamav is a free open source antivirus. To install clamav on Ubuntu/Debian, run
apt install clamav -y
To update ClamAV virus definitions, run
freshclam
To scan a folder for virus/malware, see Scan a folder with clamscan