Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:commands [2011/02/07 14:39]
cyril [List]
linux:commands [2024/04/19 13:59] (current)
cyril [List]
Line 1: Line 1:
-====== Current Commands ======+====== Usual Commands ======
  
 ===== Links ===== ===== Links =====
Line 51: Line 51:
 | lshw | | | lshw | |
 ^  File content manipulation  ^^ ^  File content manipulation  ^^
 +| ''cat file | head -n 2'' ,   ''cat file | tail -n 2'' |   |
 | ''cat file | grep <string>'' | only print lines containing string (-e for regexp) | | ''cat file | grep <string>'' | only print lines containing string (-e for regexp) |
 | grep -r <string> * | search recursively the string in all files | | grep -r <string> * | search recursively the string in all files |
Line 56: Line 57:
 | ''cat <file> | sed 's/string1/string2/g'' | replace string1 by string2 (and a lot more with sed) | | ''cat <file> | sed 's/string1/string2/g'' | replace string1 by string2 (and a lot more with sed) |
 | ''sed -i 's/string1/string2/g <files>'' | replace string1 by string2 in all files | | ''sed -i 's/string1/string2/g <files>'' | replace string1 by string2 in all files |
-| perl -pi -e "s/string1/string2/g" <files> | replace string1 by string2 in all files (and a lot more with perl) |+''echo "Image 10:55.jpg" | sed 's/([0-9]{2}).jpg/\1 #1.jpg/' '' | example with more complex regex | 
 +| ''perl -pi -e "s/string1/string2/g" <files>'' | replace string1 by string2 in all files (and a lot more with perl) |
 | ''awk 'NR>10 && NR<1000 {print $#}' <file-in>'' | extract lines 10 to 1000 from file-in to file-out | | ''awk 'NR>10 && NR<1000 {print $#}' <file-in>'' | extract lines 10 to 1000 from file-in to file-out |
 | ''awk '{ print "[10]("$1","$4","$5","$6")" }' <file-in>'' | reorganize and reformat columns of a file | | ''awk '{ print "[10]("$1","$4","$5","$6")" }' <file-in>'' | reorganize and reformat columns of a file |
 | ''awk 'NR==1 { t=$1 } NR>1 { dt=t-$1; t=$1; print dt; }' <file-in>'' | output the difference between two consecutive lines | | ''awk 'NR==1 { t=$1 } NR>1 { dt=t-$1; t=$1; print dt; }' <file-in>'' | output the difference between two consecutive lines |
 | ''cat <file> | tr '[:lower:]' '[:upper:]' '' | convert lowercase to uppercase (and a lot more with tr) | | ''cat <file> | tr '[:lower:]' '[:upper:]' '' | convert lowercase to uppercase (and a lot more with tr) |
 +| ''date +"%Y/%m/%d %H:%M:%S" | tr '\012' ' ' >> log.log'' | write date in a file without the last line return |
 | ''cat <file> | wc -l'' | count number of lines (and a lot more with wc) | | ''cat <file> | wc -l'' | count number of lines (and a lot more with wc) |
 | iconv -f iso-8859-15 -t utf8 <file> | convert file content from encoding latin9 to utf8 (see also ''recode'') | | iconv -f iso-8859-15 -t utf8 <file> | convert file content from encoding latin9 to utf8 (see also ''recode'') |
 | convmv -f iso-8859-15 -t utf8 -r <folder> | convert file names of files in folder from encoding latin9 to utf8 | | convmv -f iso-8859-15 -t utf8 -r <folder> | convert file names of files in folder from encoding latin9 to utf8 |
 | paste | merge files by concatenating columns | | paste | merge files by concatenating columns |
 +| numfmt --to=iec --format="%.2f" | to convert numbers to and from human-readable format |
 ^  Programming  ^^ ^  Programming  ^^
-| nm / ldd / realdelf [-d] | check infos about link in exe and libs |+| nm [-D] / objdump / ldd / readelf [-s] | check infos about link and symbols in exe and libs |
 | strace | list system calls a program issues | | strace | list system calls a program issues |
  
 +tr '\012' ' '
linux/commands.1297089562.txt.gz · Last modified: 2013/09/19 16:42 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0