Source: Linux Addicted
Use Command Check Process:
#top
or
#ps aux
or
#ps -el
or
#ps aux | awk '{ print $8 " " $2 }' | grep -w Z
or
#ps -elf | grep Z
or
#ps -ef | grep firefox
Output:
Z 6502
Z 8320
Z 6985
Use Command kill zombie Process:
# kill -9 6985
Source: commandlinefu.com
Terminal – Rename all files which contain the sub-string ‘foo’, replacing it with ‘bar’
for i in ./*foo*;do mv -- "$i" "${i//foo/bar}";done
Rename all files which contain the sub-string ‘foo’, replacing it with ‘bar’
That is an alternative to command 8368.
Command 8368 is EXTREMELY NOT clever.
- Will break also for files with spaces AND new lines in them AND for an empty expansion of the glob ‘*’
- For making such a simple task it uses two pipes, thus forking.
- xargs(1) is dangerous (broken) when processing filenames that are not NUL-terminated.
- ls shows you a representation of files. They are NOT file names (for simple names, they mostly happen to be equivalent). Do NOT try to parse it.
Why? see this :http://mywiki.wooledge.org/ParsingLs
Recursive version:
find . -depth -name "*foo*" -exec bash -c 'for f; do base=${f##*/}; mv -- "$f" "${f%/*}/${base//foo/bar}"; done' _ {} +
Alternatives
ls * | sed -e 'p;s/foo/bar/' | xargs -n2 mv
Renames all files in a directory named foo to bar.
- foobar1 gets renamed to barbar1
- barfoo2 gets renamed to barbar2
- fooobarfoo gets renamed to barobarfoo
NOTE: Will break for files with spaces AND new lines AND for an empty expansion of the glob ‘*’
rename 's/foo/bar/g' ./* $ ls
thisFileIsCalledDAVE
$ rename 's/DAVE/PETE/g' ./*
$ ls
thisFileIsCalledPETE
Would this command line achieve the desired function? My CLI knowledge is not great so this could certainly be wrong. It is merely a suggestion for more experienced uses to critique. Best wishes roly 🙂
for f in *; do mv "$f" "${f/foo/bar}"; done
without sed, but has no problems with files with spaces or other critical characters
ls | sed 'p;s/foo/bar/' | xargs -n2 mv
rename foo bar directory/filename
rename command in my system -Fuduntu running 2.6.38 Linux Kernel- is an ELF 64-bit LSB executable, not a Perl script. man page for rename command shows syntax as « rename from to where » (or something like that), so I am doing just what I have been told…
If your daily activity requires loging in a lot of Linux systems through SSH, you will be happy to know (if you don’t already) that there’s a way to allow secure, authenticated remote access, file transfer, and command execution without having to remember passwords for each individual host you connect.
The $HOME/.ssh/authorized_keys file contains the RSA keys allowed for RSA authentication. Each line contains one key, which consists of the following fields: options, bits, exponent, modulus and comment. The first field is optional, bits, exponent and modulus fields give the RSA key and the last field isn’t used at all in the authentication process, but it will be somewhat convenient to the user, for instance to know which key is for which machine.
Before we start, make sure your computer has a ssh client installed and the remote Linux system has ssh installed and sshd running, with RSA authentication enabled (RSAAuthentication yes in /etc/ssh/sshd_config).
Lire la suite…
Source: Comment ça marche
Les commandes suivantes nécessitent d’avoir un compte sur la machine sur laquelle on veut se connecter et qu’un serveur SSH y soit installé.
Sous Linux, la syntaxe est simple (le client étant intégré dans la plupart des distributions) :
Dans un terminal (n’importe lequel), tapez :
ssh login:motDePasse@MachineSurLaquelleJeveuxmeconnecter
ou
login@(machine sur laquelle je veux me connecter )
Dans ce cas-là, si la machine accepte la connexion, le mot de passe vous sera demandé juste après.
Pour se logguer en mode graphique (utiliser un serveur X), il faut utiliser l’option -X.
Utilisation de SSH à travers un proxy
Installez tout d’abord le paquet proxy-connect :
sudo aptitude install proxy-connect
Modifiez le fichier /etc/ssh/ssh_config pour permettre l’utilisation de SSH en passant par le proxy :
sudo echo 'ProxyCommand /usr/bin/connect-proxy -4 -S monproxy.domaine.com:port %h %p' >> /etc/ssh/ssh_config
Veillez à bien remplacer « monproxy.domaine.com » et « port » par le nom de votre proxy et son numéro de port.
Lorsque vous utilisez Webmin pour administrer votre serveur, les paramètres de votre firewall iptables sont visibles et manageables depuis la console Webmin.
Toutefois, les règles iptables présentées par Webmin sont celles qui ont été préalablement sauvées par /sbin/iptables-save dans le fichier que vous avez choisi.
Donc si vous utilisez un script depuis le shell pour changer les règles de iptables, ce ne seront pas ces règles que Webmin vous présentera mais celles que vous avez sauvées préalablement avec Webmin.When using Webmin as an administration tool, iptables rules visible for Webmin are those previously saved through Webmin.
So when you use a shell script to change iptables rules on the fly, these rules won’t be the ones Webmin present to you.
The solution is to use:
iptables-save > the_file_used_by_webmin_last_time_you_backed_up_rules
to retrieve the exact actual state of iptables rules.