Good questions to ask if you want to hire a Linux Sysadmin.
Or good questions to ask yourself before before applying to a new job.
Ha a look at: trimstray/test-your-sysadmin-skills
Zufällig gesammelte Themen
Good questions to ask if you want to hire a Linux Sysadmin.
Or good questions to ask yourself before before applying to a new job.
Ha a look at: trimstray/test-your-sysadmin-skills
Simply run
df -h | grep -v tmpfs
-v
inverts the grep
If you have a big log folder and you want to tar the newest log files in to one tar.gz file, then you can use the following:
find /opt/tomcat/logs/ -type f -newermt 2013-06-09 | tar cvzf testfind.tar.gz -T - --null
I do not know the meaning of -T - --null
, but it works.
Perhaps your find version is to old for the newermt
statement. With find version 4.2.27 it did not work. Then you could use -mtime
, for modification time.
mtime
is the number * 24 h, do find all files older newer then one day, you can use:
find /opt/tomcat/logs/ -type f -mtime 1
+1 would mean older than one day
This tutorial shows how to upgrade PostgreSQL from 9.4 (openSUSE 42.2) to 9.6 (openSUSE 42.3)
systemctl stop postgresql.service
systemctl disable postgresql.service
zypper -n install postgresql96 postgresql96-server postgresql96-contrib
mv /var/lib/pgsql/data/ /var/lib/pgsql/data94/
su postgres -c "mkdir /var/lib/pgsql/data"
systemctl enable postgresql.service
systemctl start postgresql.service
systemctl stop postgresql.service
su - postgres -c "pg_upgrade -b /usr/lib/postgresql94/bin/ -B /usr/lib/postgresql96/bin/ -d /var/lib/pgsql/data94/ -D /var/lib/pgsql/data"
cp /var/lib/pgsql/data94/pg_hba.conf /var/lib/pgsql/data
systemctl start postgresql.service
# psql -U postgres
psql (9.6.4)
Type "help" for help.
postgres=# \q
/var/lib/pgsql/delete_old_cluster.sh
Mit diesem Befehl kann das Laptop-Modell angezeigt werden.
sudo dmidecode | grep -A 9 "System Information"
Quelle: https://askubuntu.com/questions/258922/how-to-display-notebook-model-number
Allgemeine Infos zu journalctl:
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs
journalctl -u tomcat7.service
Quelle ubuntuusers.de
Wie (und ob) das Journal gespeichert wird, wird über den Wert des Schlüssels Storage geregelt. Unter Ubuntu ist der Standardwert auto. Dabei wird die Journal-Datei im Verzeichnis/run/log/UUID_DES_VERZEICHNISSES/ angelegt und geht nach dem Herunterfahren des Systems verloren.
Damit die Journaldateien - und damit alle Logs - für längere Zeit gespeichert werden, gibt es zwei Möglichkeiten:
Storage=auto
Storage=persistent
Nach einem Neustart des Systems wird der Ordner /var/log/journal/ automatisch angelegt und das Journal wird dort dauerhaft gespeichert.
find all programms with SUID bit
find / -perm -u+s
Cut some rows
cut -d " " -f2-4 messages
with tee we drop shit in a file and in stdout
grep kernel /var/log/messages | tee /root/my.log
with xargs we give in this expample the command host the output line by line:
cut -d " " -f1 localhost_access_log.2014-11-19.txt | sort | uniq | xargs -n1 host
ps -C tail
ps and show all processes of the program tail
pstree -pna
-p = show PID
-n = sort by PID
-a = shows options and arguments
top -bi -d 1 > file.txt
-b = batch mode to put it in a file
-i = show only the active ones
-d 1 = every 1 sec
Like that the file.txt has every second the active processes in top
kill -l
shows you all available signals you can send to the process
1) SIGHUP: Hang-up-signal, for daemons to reload their config
9) SIGKILL: to kill the process
15) SIGTERM: to terminate the process
other
2) SIGINT: like Ctrl+C, but much more fun
18) SIGCONT: continue processes which are put in the background with bg and fg (or with 19)
19) SIGSTOP: bg, but also much more fun
20) SIGSTP: like ctrl+z.
with w
we see the logged in users