add some old commands when revising LPIC 1

wonder if anyone will read this commit messages.
This commit is contained in:
onceupon 2018-10-25 00:42:42 +08:00 committed by GitHub
parent b13840742e
commit 1e9abe3dfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
# Bash-Oneliner
I am glad that you are here! I started working on bioinformatics four years ago (recently switched to cloud computing), and was amazed by those single-word bash commands which are much faster than my dull scripts, so much time can be saved through knowing command-line shortcuts and scripting. Not all the code here is oneliner (if the ';' counts..), but i put effort on making them brief and fast. I am mainly using Ubuntu, RedHat and Linux Mint, sorry if the commands dont work on your system.
This blog will focus on simple bash commands for parsing data; some of them are for Linux system maintenance. I apologize that there are no detailed citation for all the commands, but they are probably from dear Google and Stackoverflow.
This blog will focus on simple bash commands for parsing data; some of them are for Linux system maintenance i acquired from work and when i was studying LPIC (I have LPIC1 certificate now ^^). I apologize that there are no detailed citation for all the commands, but they are probably from dear Google and Stackoverflow.
English and bash are not my first language, so... correct me anytime, thank you!
And if you know any cool command that are not included here, Please Teach Me.
@ -723,7 +723,10 @@ xargs -t abcd
##### With find and rm
```bash
find . -name "*.html"|xargs rm -rf
find . -name "*.html"|xargs rm
# when using a backtick
rm `find . -name "*.html"`
```
##### Delete fiels with whitespace in filename (e.g. "hello 2001")
@ -1355,6 +1358,10 @@ $echo $PATH
```bash
$env
```
##### Unset environment variable (e.g. unset variable 'MYVAR')
```bash
unset MYVAR
```
##### Show partition format
@ -2013,12 +2020,23 @@ or
nl -w1 -s ' '
# making it simple, blank seperated
```
##### Combine/ paste two files (e.g. fileA, fileB)
##### Join two files field by field with tab (default join by the first column of both file, and default separator is space)
```bash
# fileA and fileB should have the same ordering of lines.
join -t '\t' fileA fileB
# Join using specified field (e.g. column 3 of fileA and column 5 of fileB)
join -1 3 -2 5 fileA fileB
```
##### Combine/ paste two or more files into columns (e.g. fileA, fileB, fileC)
```bash
paste fileA fileB
paste fileA fileB fileC
# default tab seperated
```
##### Reverse string
```bash
@ -2683,5 +2701,15 @@ sort -k3,3 -s
```bash
cat file.txt|rev|column -t|rev
```
##### To both view and store the output
```bash
echo 'hihihihi' | tee outputfile.txt
# use '-a' with tee to append to file.
```
##### Show non-printing (Ctrl) characters with cat
```bash
cat -v filenme
```
=-=-=-=-=-A lot more coming!! =-=-=-=-=-=-=-=-=-=waitwait-=-=-=-=-=-=-=-=-=-