Difference between revisions of "HowToLinuxCommands"

From Lost In Wonderlands
Jump to: navigation, search
(useful commands)
(combining find and command using exec)
 
(12 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
* [[Technoverse]]
 
* [[Technoverse]]
 
* [[git]]
 
* [[git]]
 +
 +
== guides ==
 +
 +
=== Unix Shell ===
 +
* working with file and directories
 +
** https://swcarpentry.github.io/shell-novice/03-create/index.html
 +
* Shell
 +
** https://swcarpentry.github.io/shell-novice/06-script/index.html
 +
* how to find things
 +
** https://swcarpentry.github.io/shell-novice/07-find/index.html
 +
  
 
== useful commands ==
 
== useful commands ==
  
cd
+
=== cd ===
 +
 
 +
=== cp ===
 +
 
 +
=== df ===
 +
 
  
 +
=== ls ===
 
  ls
 
  ls
 
  ls -al
 
  ls -al
 
  ls -alf
 
  ls -alf
  
mv
+
=== ln ===
  
cp
+
=== mv ===
  
rm
+
=== mkdir ===
  
mkdir
+
=== rm ===
  
touch
+
=== touch ===
  
ln
+
=== Find ===
  
grep  
+
=== grep ===
  
awk
+
=== awk ===
  
sed
+
=== sed ===
  
cat  
+
=== cat ===
  
less
+
=== less ===
  
vi  
+
=== vi ===
  
vim
+
=== vim ===
  
ssh
+
=== ssh ===
  
scp
+
=== scp ===
  
  
 
 
== How To ==
 
== How To ==
  
=== find and grep ===
+
== How To ==
  
 +
=== using grep ===
 +
grep -rwl '/path/' -e "string"
 +
grep -rwl '/path/' -e "string" | grep 'path_string'
 +
 +
=== combining find and command using exec ===
 +
* tous les dossiers appelés target
 +
find -name target -type d
 +
 +
*  effacer tous les dossier nommé "target"  executer un rm recursif, le dossier target est utilisé part maven entres autres
 +
find -name target -type d -exec rm -r {} \;
 +
 +
* chercher une chaine searched_string_in_file dans les fichers *.cxx
 
  find . -type f -name "*.cxx" -exec grep "searched_string_in_file" {} \;
 
  find . -type f -name "*.cxx" -exec grep "searched_string_in_file" {} \;
 +
 +
* ajouter -print pour afficher le fichier conteneur
 +
find . -type f -name "*.cxx" -exec grep "searched_string_in_file" {} \; -print
 +
 +
 +
* filtrer le chemin d'access  et afficher le fichier
 +
find /path -path '*path_string*' -type f -exec grep -qw 'string' {} \; -print
 +
 +
* update all git subdirectories
 +
find . -name .git -type d -exec git --git-dir '{}' fetch --all ';'
 +
find . -type d -name .git -d 2 -exec git --git-dir '{}' fetch \; -print
 +
find . -type d -name ".git" -exec git --git-dir '{}' pull \; -print
 +
find . -type d -name ".git" -exec git --git-dir '{}' reset --hard origin/master \; -print
 +
 +
=== patch ===
 +
==== patch command ====
 +
* https://doc.ubuntu-fr.org/patch
 +
* https://wiki.debian-fr.xyz/Utiliser_diff_et_patch
 +
 +
==== with git ====
 +
* https://www.devroom.io/2009/10/26/how-to-create-and-apply-a-patch-with-git/
 +
* https://geekeries.de-labrusse.fr/?p=3212
 +
* https://stackoverflow.com/questions/2249852/how-to-apply-a-patch-generated-with-git-format-patch
 +
 +
=== Activate core dumps and other systems limits ===
 +
 +
*https://www.akadia.com/services/ora_enable_core.html
 +
*https://linux-audit.com/understand-and-configure-core-dumps-work-on-linux/
 +
*https://linuxhint.com/linux_ulimit_command/
 +
*https://superuser.com/questions/1200539/cannot-increase-open-file-limit-past-4096-ubuntu
 +
 +
* activate for all users
 +
 +
ulimit -a
 +
* then set for a user
 +
 +
ulimit -c unlimited
 +
 +
* system config files
 +
 +
/etc/security/limits.conf
 +
 +
 +
 +
 +
 +
* Ubuntu
 +
Apport is managing core dump (16.04)
 +
 +
sudo systemctl enable apport.service
 +
sudo service apport start.
 +
 +
/etc/apport/crashdb.conf
 +
 +
cat /proc/sys/kernel/core_pattern
 +
  |/usr/share/apport/apport %p %s %c %d %P %E
 +
 +
location:
 +
 +
/var/crash/

Latest revision as of 19:13, 15 January 2021

How To Something

NeXT Steps

 here everything has yet to be done !

coming soon :


Everything You Always Wanted to Know on git [seldom]... (But Were Afraid to Ask) a collection of links of interest

See also

guides

Unix Shell


useful commands

cd

cp

df

ls

ls
ls -al
ls -alf

ln

mv

mkdir

rm

touch

Find

grep

awk

sed

cat

less

vi

vim

ssh

scp

How To

How To

using grep

grep -rwl '/path/' -e "string"
grep -rwl '/path/' -e "string" | grep 'path_string'

combining find and command using exec

  • tous les dossiers appelés target
find -name target -type d
  • effacer tous les dossier nommé "target" executer un rm recursif, le dossier target est utilisé part maven entres autres
find -name target -type d -exec rm -r {} \;
  • chercher une chaine searched_string_in_file dans les fichers *.cxx
find . -type f -name "*.cxx" -exec grep "searched_string_in_file" {} \;
  • ajouter -print pour afficher le fichier conteneur
find . -type f -name "*.cxx" -exec grep "searched_string_in_file" {} \; -print 


  • filtrer le chemin d'access et afficher le fichier
find /path -path '*path_string*' -type f -exec grep -qw 'string' {} \; -print
  • update all git subdirectories
find . -name .git -type d -exec git --git-dir '{}' fetch --all ';'
find . -type d -name .git -d 2 -exec git --git-dir '{}' fetch \; -print
find . -type d -name ".git" -exec git --git-dir '{}' pull \; -print
find . -type d -name ".git" -exec git --git-dir '{}' reset --hard origin/master \; -print

patch

patch command

with git

Activate core dumps and other systems limits

  • activate for all users
ulimit -a
  • then set for a user
ulimit -c unlimited
  • system config files
/etc/security/limits.conf



  • Ubuntu

Apport is managing core dump (16.04)

sudo systemctl enable apport.service 
sudo service apport start.
/etc/apport/crashdb.conf
cat /proc/sys/kernel/core_pattern
 |/usr/share/apport/apport %p %s %c %d %P %E

location:

/var/crash/