background preloader

POSIX & linux commands

Facebook Twitter

SAIT : Gestion des processus - [GNU/Linux] Généralités | (Haut de page) | Linux sait gérer plusieurs programmes simultanément. C'est ce que l'on nomme le multitâche. Dans un environnement graphique, ce concept est plus évident de part la présence de plusieurs fenêtres à l'écran. Toutefois cet article s'interessera plutôt à la gestion du multitâche en ligne de commande. Ce qui est désigné comme processus est une instance de programme s'exécutant à un instant donné ainsi que son contexte (ou environnement). Ce dernier terme désigne l'ensemble des ressources utilisées par le programme pour pouvoir se dérouler comme par exemple la mémoire ou les fichiers ouverts. Les processus sont identifiés par un numéro unique dans le système à un moment donné : le PID. Ils sont de plus organisés en hiérarchie. Cette hierarchie a une racine. Init lance aussi un programme permettant à un utilisateur (ou plusieurs) de se connecter au système.

Etats des processus | (Haut de page) | ActifExécutableEndormiZombie Un processus endormi ne fait rien. La mémoire sous Linux : analyse du fichier /proc/meminfo - Sygus. Dans cet article, je vais tenter d'expliquer les différentes informations que le noyau Linux nous donne au travers du fichier /proc/meminfo. Comme support, je vais afficher les données qui concernent mon système. Il s'agit d'un noyau 2.6.24-1 dans une Debian unstable. Ma machine repose sur une architecure x86 en 32 bits et contient une barrette de 1 Go de mémoire RAM. Commençons par les premières lignes : Sur une architecture x86 32 bits, la mémoire physique est séparée en trois zones. HighTotal : la quantité de mémoire vive présente dans la zone ZONE_HIGHMEM.HighFree : la quantité de mémoire vive non utilisée et présente dans la zone ZONE_HIGHMEM.LowTotal : la quantité de mémoire vive présente dans le zone ZONE_NORMAL.LowFree : la quantité de mémoire vive non utilisée et présente dans la zone ZONE_NORMAL.

Vérifions : HighTotal + LowTotal = 131008 + 905248 = 1036256 = MemTotal HighFree + LowFree = 252 + 57468 = 57720 = MemFree Chouette, ça colle ! Minimizing Memory Usage for Creating Application Subprocesses. Oracle Technology Network > Java Software Downloads View All Downloads Top Downloads New Downloads What's New Java in the Cloud: Rapidly develop and deploy Java business applications in the cloud. Start for free. Essential Links Developer Spotlight Java EE—the Most Lightweight Enterprise Framework? Blogs Technologies Contact Us About Oracle Cloud Events Top Actions News Key Topics Oracle Integrated Cloud Applications & Platform Services. OOM : gestion préventive de la mémoire. Si l’OOM killer se déclenche sur votre serveur alors qu’il reste une bonne quantité de mémoire, conduisant au quasi crash du serveur (kill du serveur X, mysql, SSH, …), alors il vous sera peut-être nécessaire de changer le comportement de celui ci pour le désactiver.

Cela se voit par des messages du genre « invoked oom-killer » dans les logs systèmes: ... Jan 28 00:52:58 box kernel: [15199.058126] mysqld invoked oom-killer: gfp_mask=0x44d0, order=2, oomkilladj=0 Jan 28 00:52:58 box kernel: [15199.058145] Pid: 5572, comm: mysqld Not tainted 2.6.28-17-generic #58-Ubuntu Jan 28 00:52:58 box kernel: [15199.058158] Call Trace: Jan 28 00:52:58 box kernel: [15199.058183] [ Pour changer ce comportement, il suffit de faire sudo -i echo 2 > /proc/sys/vm/overcommit_memory Pour conserver ce changement au redémarrage sudo cp /etc/sysctl.conf /etc/sysctl.conf.org echo "vm.overcommit_memory = 2" | sudo tee -a /etc/sysctl.conf Commentaires fermés :: Ajouter un commentaire.

Write a message to login users through SSH. March 10th, 2007 mysurface Posted in Admin, Common, wall, who, write | Hits: 282732 | 35 Comments » To write a message to users that have login, you can using the command write. But before that, you need to check who is login, and which terminal he is login to, use command who. Let say you was unable to call your friend, maybe he forgot to bring his cellphone and you know he is login to a linux server doing something, and you have permission to ssh to that particular server, then you can write him a message.

First, type: who who will list of all user have login and and login to which terminal, you will see something like pts/0, pts/1. Example output: aizatto pts/0 2007-03-10 02:21 (:0.0) With the information, now you can write messages to the user aizatto. write aizatto pts/0 After typing the command line above, you can start to type your messages. You can cat a file and pipe to write command too. cat memo.txt | write aizatto pts/0. Dd (Unix) Usage varies across different operating systems. Also, certain features of dd will depend on the computer system capabilities, such as dd's ability to implement an option for direct memory access. Sending a SIGINFO signal (or a USR1 signal on Linux) to a running dd process makes it print I/O statistics to standard error once and then continue copying. dd can read standard input from the keyboard. When end-of-file (EOF) is reached, dd will exit. Signals and EOF are determined by the software. For example, Unix tools ported to Windows vary as to the EOF: Cygwin uses Ctrl+D (the usual Unix EOF) and MKS Toolkit uses ctrl+z (the usual Windows EOF).

The GNU variant of dd as supplied with GNU coreutils does not describe the format of the messages displayed on standard output on completion. The value provided for block size options is interpreted as a decimal (base 10) integer number of bytes. For some uses of the dd command, block size has an effect on performance.

Write performance: Unix Tree / Linux Tree • Display Structure of Directory Hierarch. One-Line Shell Script ls, grep, and sed Quick, what does the following Unix/Linux command do? If you said, "Well, that's obvious; it shows a graphical representation of the current sub-directories. ", you'd be correct. You can use the command to create a program called tree that would work something like the following: Here's the command ready-to-go in a shell script: #! View/download That's it. Note: On some systems there is a directory search utility called find which returns a tree-like list.

ColorsGoogle Tony Lauro's Colorized Version "Thank you very much man for this tool ;)" P., January 30, 2010 "Was literally damn useful..Gr8 work" A., December 2, 2009 "The script works very well. "nice one .it helped me alot.thnx a lot.Cheers:-)" M., September 19, 2009 "small and powerful as a bash script should be! " "Very handfull! "'Those who command the shell shall inherit the earth..' - Nice, elegant work! " "That's awesome man! " "Beautiful & powerful ! " "Awesome! "simple and nice.. " "This is great! [md5sum] Vérifier l'intégrité des téléchargements. Introduction Un petit tutoriel pour le programme "md5" ou "md5sum" communément appelé "checksum".

L'utilitaire md5sum permet de calculer ce qu'on appelle l'empreinte d'un fichier. En anglais, fingerprint, message-digest ou encore checksum est une valeur de 128 bits correspondant à une somme de contrôle calculée à partir de l'archive. Cette signature est unique pour chaque fichier et il est pour le moment non-craqué. Un checksum MD5 n'a pas pour but de garantir la provenance d'un fichier ou d'un groupe de fichiers. En gros, en comparant le MD5 du fichier que vous venez de récupérer au MD5 que le site de téléchargement vous donne, vous pouvez être sûr que le site et vous ayez le même fichier. Windows Pour les puristes de la ligne de commande (sous "Dos") Commencez par télécharger la version ".zip" pour Windows à cette adresse : Télécharger MD5 Note :Vous pouvez depuis le site fourmilab télécharger .tar.gz la version pour Linux. Décompressez l'archive dans un dossier à la racine de 'C:'.

Mst MD5. [Linux] Découper un fichier en plusieurs parties. Netstat sous linux. Netstat renvoi beaucoup d'informations techniques qui ne sont pas toujours facile à comprendre. Netstat est une importante commande Dos, très utile, qui peut servir dans plusieurs domaine. Table de routage, sockets, connections, protocoles, sécurité... je vais tenter de vous expliquer du mieux possible les commandes. En matière de réseau, il est souvent utile de savoir si notre ordinateur est directement connecté à un serveur ou même à un autre ordinateur. Par exemple, vous voulez savoir si une personne mal attentionnée est connectée à votre ordinateur. Ceci est très simple avec la commande Netstat Ovrer une konsole et en root taper netstat Définition des Termes Techniques La socket est une sorte de liaison entre deux ordinateurs.

La socket est simplement là afin d'établir un lien (Comme un câble RJ45) entre deux ordinateurs à l'aide d'un protocole et d'un ou plusieurs ports. Le terme socket peut être remplacé par "Interface de connexion" ou par "Connecteur réseau".Explication des Résultats. The Ultimate Bash Array Tutorial with 15 Examples. An array is a variable containing multiple values may be of same type or of different type. There is no maximum limit to the size of an array, nor any requirement that member variables be indexed or assigned contiguously. Array index starts with zero. In this article, let us review 15 various array operations in bash. This article is part of the on-going Bash Tutorial series. For those who are new to bash scripting, get a jump-start from the Bash Scripting Introduction tutorial. 1. In bash, array is created automatically when a variable is used in the format like, name[index]=value name is any name for an arrayindex could be any number or expression that must evaluate to a number greater than or equal to zero.You can declare an explicit array using declare -a arrayname. $ cat arraymanip.sh #!

To access an element from an array use curly brackets like ${name[index]}. 2. Syntax: declare -a arrayname=(element1 element2 element3) #! 3. 4. ${#arrayname[@]} gives you the length of the array. 5. 6. Getopt and getopts. Getopt and getopts Improve your scripts argument processing wih getopt and getopts. Both "getopt" and getopts are tools to use for processing and validating shell script arguments. They are similar, but not identical. More confusingly, functionality may vary from place to place, so you need to read the man pages carefully if your usage is more than casual. Properly handling command line arguments is difficult if you want the usage to be flexible. Foo -a -b -c foo -abc foo -a -c +b foo -ac +b These are the problems that getopt(s) are designed to handle.

Getopt This is a standalone executable that has been around a long time. The simple use of "getopt" is shown in this mini-script: #! What we have said is that any of -a, -b, -c or -d will be allowed, but that -c is followed by an argument (the "c:" says that). If we call this "g" and try it out: bash-2.05a$ . We start with two arguments, and "getopt" breaks apart the options and puts each in its own argument. Bash-2.05a$ . args=`getopt :abc:d $*` #! What is the best way to check the getopts status in bash.