Affichage des articles dont le libellé est linux. Afficher tous les articles
Affichage des articles dont le libellé est linux. Afficher tous les articles

mardi 9 novembre 2021

Linux cleaning tips (systemd, apt/ubuntu, docker)

 (evolutive article where I store what's been useful to me to clean space on linux servers I'm using)

Note : my current servers are running Ubuntu.



OS / SystemD : purge logs bigger than ...

Only keep 10M of each log files handle through syslog

sudo journalctl --vacuum-size 10M


OS / apt : remove remnants

Remove automatically all unused packages Remove automatically installed packages not needed anymore (i.e. packages that were installed as dependencies of packages that have now been removed or aren't requiring this dependency anymore)

apt options :

  •   autoremove - Remove automatically all unused packages
  •   clean - Erase downloaded archive files
  •   autoclean - Erase old downloaded archive files

sudo apt-get clean autoremove autoclean



Docker : remove logs older than ...

Only keep the last 1000h of docker containers logs

sudo docker image prune --all --filter "until=1000h" -f


Docker : remove remnants

Be careful ! If your docker environments are not running they might be deleted by some of the following commands !

Remove unused volumes, containers, images, networks, etc.

sudo docker system prune -f 

sudo docker system prune -a --volumes


dimanche 10 octobre 2010

(links) For my camera


AVCHD Videos

I've got a Panasonic DMC-ZX3 since a few month and I found a few informations on how to view, convert, etc. the videos it takes. They are in HD and outputed in a strange .MTS files (and some others, I'll write more on that some time later). Regular players can't read those files, and I eventually found some converting tools under linux (I'm using ubuntu)


AVCHD = sudo apt-get install libavcodec-extra-52 winff openshot
http://blog.yann.info/2010/05/16/avchd-pour-les-nuls-et-les-pauvres/





Tethering (using computer as a screen for the camera while shooting)

Meanwhile, I found this website explaining how to use your computer screen for your camera. I didn't test already, but I like the idea.


http://grahambinns.com/blog/2010/04/18/gphoto2-f-spot-win/

dimanche 23 août 2009

live network trafic view ? iptraf, iftop

A explorer

http://www.commentcamarche.net/faq/sujet-848-linux-trafic-entrant-sortant-en-temps-reel


On trouvera ci dessous les extraits des deux manpages de iptraf et ethstatus.
Intéressant pour comptabiliser la quantité de données qui circulent sur les différentes interfaces, ainsi que pour monitorer quelles sont les connexions ouvertes.

Après un bref test, "ethstatus" m'a cependant l'air d'utiliser beaucoup de ressources CPU, et semble être surtout un reformatage des infos d'ifconfig. Peu intéressant donc.

Au contraire, "iptraf" était plus léger et apportait plus d'informations.

Egalement, iftop fourni plus d'informations et permet de lister les connextions courantes un peu comme "top" le ferait.






IPTRAF(8) IPTRAF(8)

NAME
iptraf - Interactive Colorful IP LAN Monitor

SYNOPSIS
iptraf { [ -f ] [ -q ] [ -u ] [ { -i iface | -g | -d iface | -s iface |
-z iface | -l iface } [ -t timeout ] [ -B [ -L logfile ] ] ] | [ -h ] }

DESCRIPTION
iptraf is an ncurses-based IP LAN monitor that generates various net‐
work statistics including TCP info, UDP counts, ICMP and OSPF informa‐
tion, Ethernet load info, node stats, IP checksum errors, and others.

If the command is issued without any command-line options, the program
comes up in interactive mode, with the various facilities accessed
through the main menu.



IFTOP(8) IFTOP(8)

NAME
iftop - display bandwidth usage on an interface by host

SYNOPSIS
iftop -h | [-nNpbBP] [-i interface] [-f filter code] [-F net/mask]

DESCRIPTION
iftop listens to network traffic on a named interface, or on the first
interface it can find which looks like an external interface if none is
specified, and displays a table of current bandwidth usage by pairs of
hosts. iftop must be run with sufficient permissions to monitor all
network traffic on the interface; see pcap(3) for more information, but
on most systems this means that it must be run as root.

By default, iftop will look up the hostnames associated with addresses
it finds in packets. This can cause substantial traffic of itself, and
may result in a confusing display. You may wish to suppress display of
DNS traffic by using filter code such as not port domain, or switch it
off entirely, by using the -n option or by pressing R when the program
is running.

By default, iftop counts all IP packets that pass through the filter,
and the direction of the packet is determined according to the direc‐
tion the packet is moving across the interface. Using the -F option it
is possible to get iftop to show packets entering and leaving a given
network. For example, iftop -F 10.0.0.0/255.0.0.0 will analyse packets
flowing in and out of the 10.* network.

mardi 2 juin 2009

Rubber : a LaTeX processing tool

I still have to test it with other .tex files, but I just discovered and tried "rubber", and LaTeX compilation seems to be pretty fast (for an 8 pages document).


It seems that it proposes a tool that compiles and analyses the LaTeX source file to generate either a ps, pdf or dvi, and to run the needed tools : makeindex, bibtex, etc. and all by itself without having to write a complicated makefile.



From "rubber" man pages :

NAME
rubber - a building system for LaTeX documents

SYNOPSIS
rubber [options] sources ...
rubber-pipe [options]

DESCRIPTION
Rubber is a wrapper for LaTeX and companion programs. Its purpose is,
given a LaTeX source to process, to compile it enough times to resolve
all references, possibly running satellite programs such as BibTeX,
makeindex, Metapost, etc. to produce appropriate data files.

The command rubber builds the specified documents completely. The
source files may be either LaTeX sources (in which case the suffix .tex
may be omitted) or documents in a format Rubber knows how to translate
into LaTeX (this currently means CWEB or Literate Haskell documents).
If one compilation fails, the whole process stops, including the compi‐
lation of the next documents on the command line, and rubber returns a
non-zero exit code.


Some Links :

mardi 21 avril 2009

date relative

Utilisation de la commande date pour calculer une date relative en nombre d'heures à partir d'une autre date.

  1. 1ère étape : entrer la date initiale avec date
    $ date --date='2009-03-23 12:00'


  2. 2ème étape : utiliser le résultat obtenu comme base pour y ajouter un décalage en nombre d'heures, soit donc :
    $ date --date="$(date --date='2009-03-23 12:00') +1001 hours"
    Mon May 4 06:00:00 CEST 2009



mercredi 4 mars 2009

commandlinefu

Fantastique !

http://www.commandlinefu.com

c'était un peu l'idée de ce blog au départ, bien que cela ait un peu dévié...

En se retrouve sur ce site avec un équivalent twitter, mais uniquement pour des lignes de commande !

exemple, cette commande que j'avais eu l'occasion de chercher un jour pour une vidéo prise avec mon appareil photo...
mencoder -vf rotate=1 -ovc lavc -oac copy "$1" -o "$1"-rot.avi

jeudi 11 décembre 2008

distribution-specific information

Example :

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04.1
Release: 8.04
Codename: hardy




lsb_release(1) lsb_release(1)

NAME
lsb_release - print distribution-specific information

SYNOPSIS
lsb_release [options]

DESCRIPTION
The lsb_release command provides certain LSB (Linux Standard Base) and
distribution-specific information.

If no options are given, the -v option is assumed.

mardi 25 novembre 2008

Hard Drive recovery / unrm linux ext3 tools

Première chose à faire : démonter la partition.
Après réflexion, c'est peut-être pas une bonne idée d'arrêter la
machine complètement, à moins d'en avoir une autre sous la main
facilement sur laquelle on peut monter le dd en question. Et sur laquelle on aura assez de place pour copier les données retrouvées.


Un des trucs à noter est que je savais précisément le format des
fichiers que je voulais récupérer : des JPEG dans mon cas.
Dans tout les cas il y en a pour un bon bout
de temps de boulot (quelques heures au mieux pour une partition ~40Go, en ne faisant que ça sur la machine).
Ne pas oublier qu'il faut après faire le tri de ce qui a été récupéré puisque la récupération des fichiers perd généralement le nom des fichiers.


Quelques pointeurs



Photorec, qui m'a donné les résultats les plus intéressants pour moi :PhotoRec_Step_By_Step


Je crois que c'est celui que j'avais utilisé, ne pas se fier au nom,
maintenant cela supporte d'autre formats de fichier.


Quelques autres liens avec des infos intéressantes, et il y a un autre soft que j'avais utilisé mais je ne sais plus lequel de ceux-là c'était
(ou peut être même encore un autre) :

lundi 27 octobre 2008

non-root mount for external usb ext3 hard drive

J'ai récemment acquis un disque dur externe USB 2.5", que j'ai formaté en ext3.

Mauvaise surprise à l'auto-détection, il est par défaut (contrairement aux clefs usb en FAT32) mis en lecture seule pour les utilisateurs lambdas, et uniquement en lecture-écriture pour root.

Lors du formatage utilisation de :


sudo fdisk /dev/sdb1
sudo mkfs.ext3 /dev/sdb1
sudo e2label /dev/sdb1 {{snip label}}




Pour modifier le mode de montage et mettre ça dans fstab, j'ai eu recours à la commande vol_id pour trouver les paramètres.


# vol_id /dev/sdb1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID={{snip}}
ID_FS_UUID_ENC={{snip}}
ID_FS_LABEL={{snip label}}
ID_FS_LABEL_ENC={{snip}}
ID_FS_LABEL_SAFE={{snip}}



J'ajoute alors dans /etc/fstab la ligne suivante :

LABEL={{snip label}} /media/{{snip mount point}} ext3 user,auto 0 0



Ca à l'air de marcher comme il faut !!





VOL_ID(8) vol_id VOL_ID(8)

NAME
vol_id - probe filesystem type and read label and uuid

SYNOPSIS
vol_id [--export] [--type] [--label] [--label-raw] [--uuid]
[--skip-raid] [--probe-all] [--help] [device]

DESCRIPTION
vol_id is usually called from a udev rule, to provide udev with the
filesystem type, the label and the uuid of a volume. It supports most
of the common filesystem formats and detects various raid setups to
prevent the recognition of raid members as a volume with a filesystem.

mardi 12 août 2008

cron + ssh + keychain

Keychain :



dans .bash_profile


#!/bin/bash
#example ~/.bash_profile file
/usr/bin/keychain private keys
#redirect ~/.ssh-agent output to /dev/null to zap the annoying
#"Agent PID" message
source ~/.ssh-agent > /dev/null


cron :


crontab -e :

42 4 * * * time /home/cm/usr/bin/script_sauvegarde.sh



script_sauvegarde.sh





#!/bin/bash

keychain $HOME/SSH_PRIV_KEY
source /home/cm/.keychain/MACHINE-NAME-sh

rsync -e ssh --exclude-from=RSYNC_EXCLUDE_FILE -Cavz CLIENT/ SERVER:PATH_ON_SERVER/

jeudi 10 mai 2007

Phone issue wammu bluetooth synchro

Bon... je vais maintenant passer à une phase de test "autre", mais j'ai enfin réussi a faire communiquer wammu et mon téléphone mobile en bluetooth. 
 Je pense qu'il est nécessaire de lancer un service que je n'ai pas identifié encore, mais qui est lancé au démérrage, automatiquement. 

 Une hypothèse envisagée sur ce problème de "pairing" est la synchro de plusieurs services, dont le bluetooth. 
Et peut-être dbus (?). 

En tout cas, le problème se situait du côté de l'échange de clef, et du lancement du passkey-agent et de l'applet bluetooth-applet permettant d'indiquer la clef qui doit être échangée entre les deux devices connectés en bluetooth (le laptop et le mobile en l'occurence).

dimanche 6 mai 2007

bluetooth in range

Pour lister les périphériques bluetooth détectés dans le voisinage, plusieurs solutions :
  • hcitool scan
    # hcitool scan Scanning ... 00:xx:xx:xx:xx:xx Phone
  • hcitool inq
    # hcitool inq Inquiring ... 00:xx:xx:xx:xx:XX clock offset: 0x1yyy class: 0x5zzzzz
http://wiki.ubuntu-fr.org/tutoriel/bluetooth-edgy http://doc.ubuntu-fr.org/materiel/bluetooth http://multisync.sourceforge.net/