LinuxAdmin: Difference between revisions

From Piszczynski
piszczynski>Aleks
piszczynski>Aleks
No edit summary
Line 54: Line 54:
If ssh in not being allowed remotely you will need to open port 22 on the firewall:
If ssh in not being allowed remotely you will need to open port 22 on the firewall:
*sudo ufw allow 22
*sudo ufw allow 22
== Linux Disk Space / Usage ==
Use the "df" command to see the disks mounted to the system
Can use df -BM to display output in blocksize megabytes or -h to output in human readable format
Use -T to disply the type of file system the mounted disk is
Use -x to exclude a type of file system eg
*df -x squashfs --total
Use -t to only include a type of filesystem eg
*df -t ext4
You can specify report of specific named file systems eg:
*df -h --total /dev /run
----
Use "du" command to show folder disk usage eg:
*du
*du -BM
*du -h
Sort output by largest to smallest size
*du -sm | sort -nr
Use du to find biggest files and sort the output:
*sudo du -a | sort -n -r | head -n 20

Revision as of 11:41, 8 June 2022


Linux System Admin

System tools for fedora/red hat:

  • DNS = system-config-bind
  • HTTP = system-config-httpd
  • NFS = system-config-nfs
  • Root password = system-config-rootpassword
  • Samba NFS = system-config-samba
  • Services = system-config-services
  • Authentication = authconfig-gtk
  • Date & Time = system-config-date
  • Firewall = system-config-firewall
  • Language = system-config-language
  • Printing = system-config-printer
  • SELinux Management = policycoreutils-gui
  • Users & Groups = system-config-users
  • Configuration Editor = gconf-editor
  • Disk Usage Analyzer = gnome-utils
  • Disk Utility = gnome-disks
  • Kickstart = system-config-kickstart

Enable service to run on boot:

  • sudo systemctl enable <service>
    • eg: sudo systemctl enable bluetooth.service

Linux Processes

  • Show running processes: ps
  • Show processes for all users: ps aux
  • Display running processes: top
  • List processes via config directory (services started at boot via script in this directory ): ls /etc/init.d or ls /etc/rc.d
  • list all processes with specific columns ( use -o parameter ): ps -e -o %mem,pid,uid,comm
  • Sort output of ps by cpu usage: ps -e --sort=%cpu


Get all processes:

  • ps -e

Search for specific process:

  • ps -e | grep <processname>

Kill process:

  • kill <processID>

Enable SSH

Install the ssh client if not already installed:

  • sudo apt install openssh-client

If you want to enable SSH on Ubuntu server, use the following command:

  • sudo apt install openssh-server

If ssh in not being allowed remotely you will need to open port 22 on the firewall:

  • sudo ufw allow 22


Linux Disk Space / Usage

Use the "df" command to see the disks mounted to the system

Can use df -BM to display output in blocksize megabytes or -h to output in human readable format

Use -T to disply the type of file system the mounted disk is

Use -x to exclude a type of file system eg

  • df -x squashfs --total

Use -t to only include a type of filesystem eg

  • df -t ext4

You can specify report of specific named file systems eg:

  • df -h --total /dev /run

Use "du" command to show folder disk usage eg:

  • du
  • du -BM
  • du -h

Sort output by largest to smallest size

  • du -sm | sort -nr

Use du to find biggest files and sort the output:

  • sudo du -a | sort -n -r | head -n 20