-
Notifications
You must be signed in to change notification settings - Fork 0
Linux utils
phuonglab edited this page Aug 2, 2021
·
13 revisions
Table of Contents
-
fzf is a general-purpose command-line fuzzy finder
-
find all files containing specific text
-
Basic
grep -rnw '/path/to/somewhere/' -e 'pattern'
-
This will only search through those files which have .c or .h extensions:
grep --include=\*.{c,h} -rnw '/path/to/somewhere/' -e "pattern"
-
This will exclude searching all the files ending with .o extension:
grep --exclude=\*.o -rnw '/path/to/somewhere/' -e "pattern"
-
For directories it’s possible to exclude one or more directories using the --exclude-dir parameter. For example, this will exclude the dirs dir1/, dir2/ and all of them matching *.dst/:
grep --exclude-dir={dir1,dir2,*.dst} -rnw '/path/to/somewhere/' -e "pattern"
-
$ git clean -fd
git clean -f
git apply --whitespace=nowarn ~/br_lge_extensions.patch
git reset --hard HEAD
git clone --recursive-
Enable ssl
⇒ Change common name during generatecd /etc/lighttpd/certs openssl req -new -x509 -keyout lighttpd.pem -out lighttpd.pem -days 365 -nodes chmod 400 lighttpd.pemlighttpd.pemkey to matching domain name192.168.123.196 -
Then edit /etc/lighttpd/lighttpd.conf and add:
$SERVER["socket"] == ":443" { ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/certs/lighttpd.pem" }
-
Curl test:
echo "" | openssl s_client -servername 192.168.123.196 -connect 192.168.123.196:443 2>/dev/null </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > client.key curl -v --cacert client.key https://192.168.123.196:443/deviceInfo
-
Use ssh without password
$ssh-keygen -t rsa $ssh-copy-id -i ~/.ssh/id_rsa.pub {user}@{host}
-
Download a single file from a remote ftp server to your machine:
$sftp {user}@{host}:{remoteFileName} {localFileName} -
Upload a single file from your machine to a remote ftp server:
$sftp {user}@{host}:{remote_dir} <<< $'put {local_file_path}'