« Commandes BASH » : différence entre les versions
| (7 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 1 : | Ligne 1 : | ||
[http://tools.marmits.com/testcideo/dedie/chmod/info.php chmod]<br /> | [http://tools.marmits.com/testcideo/dedie/chmod/info.php chmod]<br /> | ||
== Processeur == | |||
Informations sur le processeur | |||
<syntaxhighlight lang="bash" line copy> | |||
lscpu | |||
</syntaxhighlight> | |||
Pour un affichage plus simple | |||
<syntaxhighlight lang="bash" line copy> | |||
lscpu | grep -E "Model name|CPU\(s\)|Thread|Core|Socket|Virtualization" | |||
</syntaxhighlight> | |||
== Ressources == | == Ressources == | ||
| Ligne 45 : | Ligne 56 : | ||
export PS1="\[\e[\033[00;36m\]\u\[\e[m\]\[\e[\033[00;36m\]@\[\e[m\]\[\e[\033[00;36m\]\h\[\e[m\]:\[\e[\033[01;33m\]\w\[\e[m\]\[\e[\033[01;32m\]\`parse_git_branch\`\[\e[m\]\\$ " | export PS1="\[\e[\033[00;36m\]\u\[\e[m\]\[\e[\033[00;36m\]@\[\e[m\]\[\e[\033[00;36m\]\h\[\e[m\]:\[\e[\033[01;33m\]\w\[\e[m\]\[\e[\033[01;32m\]\`parse_git_branch\`\[\e[m\]\\$ " | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== .bashrc custom prompt == | |||
=== 1️⃣ Crée un fichier dédié === | |||
Par exemple : | |||
<syntaxhighlight lang="bash">~/.bash_prompt</syntaxhighlight> | |||
Contenu : | |||
<syntaxhighlight lang="bash"># Couleurs | |||
PINK='\[\033[38;2;255;105;180m\]' | |||
WHITE='\[\033[38;2;255;255;255m\]' | |||
BLUE='\[\e[1;38;2;74;138;228m\]' | |||
PURPLE='\[\e[2;38;2;245;176;245m\]' | |||
BG='\[\e[48;2;0;0;0m\]' | |||
RESET='\[\e[0m\]' | |||
# Prompt | |||
if tput setaf 1 >/dev/null 2>&1; then | |||
PS1="${debian_chroot:+($debian_chroot)}\ | |||
${PINK}\u🍇\h\ | |||
${WHITE}:\ | |||
${RESET}${BG}${BLUE}\w\ | |||
${RESET}${BG}${PURPLE}\$ " | |||
else | |||
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |||
fi</syntaxhighlight> | |||
----- | |||
=== 2️⃣ Dans ton <code>~/.bashrc</code> === | |||
Ajoute simplement : | |||
<syntaxhighlight lang="bash"> | |||
# couleurs par defaut ls | |||
if [ -x /usr/bin/dircolors ]; then | |||
eval "$(dircolors -b)" | |||
alias ls='ls --color=auto' | |||
fi | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash"># Charger le prompt personnalisé | |||
[ -f ~/.bash_prompt ] && source ~/.bash_prompt</syntaxhighlight> | |||
----- | |||
== nano == | == nano == | ||
| Ligne 139 : | Ligne 198 : | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* http://jlbicquelet.free.fr/aix/commandes/lsof.php | * http://jlbicquelet.free.fr/aix/commandes/lsof.php | ||
=== [[Grep| Grep]] === | |||
== sudo == | == sudo == | ||
| Ligne 341 : | Ligne 402 : | ||
chmod -R 755 repertoire | chmod -R 755 repertoire | ||
</syntaxhighlight> | </syntaxhighlight> | ||
----- | |||
=== Affiche la structure d'un dossier === | === Affiche la structure d'un dossier === | ||
<code>tree</code> parcourt récursivement un répertoire et affiche son contenu (dossiers et fichiers) dans une représentation hiérarchique, en utilisant des indentations et des symboles (<code>├─</code>, <code>└─</code>) pour montrer la structure. | <code>tree</code> parcourt récursivement un répertoire et affiche son contenu (dossiers et fichiers) dans une représentation hiérarchique, en utilisant des indentations et des symboles (<code>├─</code>, <code>└─</code>) pour montrer la structure. | ||
==== ✅ '''Syntaxe de base'''==== | ==== ✅ '''Syntaxe de base'''==== | ||
| Ligne 353 : | Ligne 414 : | ||
* '''Avec un chemin''' : affiche l’arborescence du répertoire spécifié. | * '''Avec un chemin''' : affiche l’arborescence du répertoire spécifié. | ||
==== ✅ '''Options utiles''' ==== | ==== ✅ '''Options utiles''' ==== | ||
| Ligne 363 : | Ligne 422 : | ||
* <code>--dirsfirst</code> : liste les dossiers avant les fichiers. | * <code>--dirsfirst</code> : liste les dossiers avant les fichiers. | ||
==== ✅ '''Exemple''' ==== | ==== ✅ '''Exemple''' ==== | ||
<syntaxhighlight lang="bash">tree -L 2 project</syntaxhighlight> | <syntaxhighlight lang="bash">tree -L 2 project</syntaxhighlight> | ||
Affiche la structure du dossier <code>project</code> avec une profondeur de 2 niveaux. | * Affiche la structure du dossier <code>project</code> avec une profondeur de 2 niveaux. | ||
<pre>project/ | <pre>project/ | ||
| Ligne 380 : | Ligne 437 : | ||
└─ README.md</pre> | └─ README.md</pre> | ||
-- | * Exclure .git et .idea | ||
<syntaxhighlight lang="bash">tree -a -I '.git|.idea'</syntaxhighlight> | |||
----- | ----- | ||