mirror of
https://github.com/LeCoupa/awesome-cheatsheets.git
synced 2026-01-25 20:58:03 -08:00
Merge branch 'LeCoupa:master' into master
This commit is contained in:
@@ -10,3 +10,5 @@ SHOW PROCESSLIST; # Show you any queries that are currently running or in the qu
|
|||||||
GRANT ALL PRIVILEGES ON prospectwith.* TO 'power'@'localhost' WITH GRANT OPTION; # Grant all privileges on database
|
GRANT ALL PRIVILEGES ON prospectwith.* TO 'power'@'localhost' WITH GRANT OPTION; # Grant all privileges on database
|
||||||
|
|
||||||
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # Create user
|
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password'; # Create user
|
||||||
|
|
||||||
|
mysql -u root -pmypassword -e "MY SQL QUERY" &>> query.log & disown # Run SQL query in the background
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
<address></address> <!-- Used to display contact information -->
|
<address></address> <!-- Used to display contact information -->
|
||||||
<code></code> <!-- Used to display inline code snippets -->
|
<code></code> <!-- Used to display inline code snippets -->
|
||||||
<q></q> <!-- Defines a short inline quotation -->
|
<q></q> <!-- Defines a short inline quotation -->
|
||||||
<sub></sub> <!-- Defines subscripted text -->
|
<sub></sub> <!-- Defines subscripted text -->
|
||||||
<sup></sup> <!-- Defines superscripted text -->
|
<sup></sup> <!-- Defines superscripted text -->
|
||||||
<kbd></kbd> <!-- Specifies text as keyboard input -->
|
<kbd></kbd> <!-- Specifies text as keyboard input -->
|
||||||
<small></small> <!-- Specifies small text -->
|
<small></small> <!-- Specifies small text -->
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ grep -r <pattern> <dir> # search recursively for pattern in directory
|
|||||||
head -n file_name | tail +n # Print nth line from file.
|
head -n file_name | tail +n # Print nth line from file.
|
||||||
head -y lines.txt | tail +x # want to display all the lines from x to y. This includes the xth and yth lines.
|
head -y lines.txt | tail +x # want to display all the lines from x to y. This includes the xth and yth lines.
|
||||||
|
|
||||||
|
sed 's/<pattern>/<replacement>/g' <filename> # replace pattern in file with replacement value to std output the character after s (/) is the delimeter
|
||||||
|
sed -i 's/<pattern>/<replacement>/g' <filename> # replace pattern in file with replacement value in place
|
||||||
|
echo "this" | sed 's/is/at/g' # replace pattern from input stream with replacement value
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# DIRECTORY COMMANDS
|
# DIRECTORY COMMANDS
|
||||||
@@ -145,6 +148,9 @@ ssh -p <port> user@host # connects to host on specified port as user
|
|||||||
ssh-copy-id user@host # adds your ssh key to host for user to enable a keyed or passwordless login
|
ssh-copy-id user@host # adds your ssh key to host for user to enable a keyed or passwordless login
|
||||||
|
|
||||||
whoami # returns your username
|
whoami # returns your username
|
||||||
|
su <user> # switch to a different user
|
||||||
|
su - # switch to root, likely needs to be sudo su -
|
||||||
|
sudo <command> # execute command as the root user
|
||||||
passwd # lets you change your password
|
passwd # lets you change your password
|
||||||
quota -v # shows what your disk quota is
|
quota -v # shows what your disk quota is
|
||||||
date # shows the current date and time
|
date # shows the current date and time
|
||||||
@@ -154,6 +160,8 @@ w # displays whois online
|
|||||||
finger <user> # displays information about user
|
finger <user> # displays information about user
|
||||||
uname -a # shows kernel information
|
uname -a # shows kernel information
|
||||||
man <command> # shows the manual for specified command
|
man <command> # shows the manual for specified command
|
||||||
|
info <command> # shows another documentation system for the specific command
|
||||||
|
help # shows documentation about built-in commands and functions
|
||||||
df # shows disk usage
|
df # shows disk usage
|
||||||
du <filename> # shows the disk usage of the files and directories in filename (du -s give only a total)
|
du <filename> # shows the disk usage of the files and directories in filename (du -s give only a total)
|
||||||
last <yourUsername> # lists your last logins
|
last <yourUsername> # lists your last logins
|
||||||
@@ -381,7 +389,7 @@ n<&m # file descriptor n is made to be a copy of the input file descriptor
|
|||||||
<&- # closes the standard input
|
<&- # closes the standard input
|
||||||
>&- # closes the standard output
|
>&- # closes the standard output
|
||||||
n>&- # closes the ouput from file descriptor n
|
n>&- # closes the ouput from file descriptor n
|
||||||
n<&- # closes the input from file descripor n
|
n<&- # closes the input from file descriptor n
|
||||||
|
|
||||||
|tee <file># output command to both terminal and a file (-a to append to file)
|
|tee <file># output command to both terminal and a file (-a to append to file)
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,24 @@ int c = a + b;
|
|||||||
System.out.println(i);
|
System.out.println(i);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
>Enhanced for loop/for-each
|
||||||
|
```java
|
||||||
|
for(dataType item : array) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
**Example:**
|
||||||
|
```java
|
||||||
|
// array of numbers
|
||||||
|
int[] numbers = {100, 200, 300, 400};
|
||||||
|
|
||||||
|
// for each loop
|
||||||
|
for (int number: numbers) {
|
||||||
|
System.out.println(number);
|
||||||
|
```
|
||||||
|
|
||||||
> WHILE LOOP STATEMENT
|
> WHILE LOOP STATEMENT
|
||||||
```java
|
```java
|
||||||
while(condition){ //till condition will be true.
|
while(condition){ //till condition will be true.
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ git grep --heading --line-number '<string/regex>' # Find lines matching the patt
|
|||||||
git log --grep='<string/regex>' # Search Commit log
|
git log --grep='<string/regex>' # Search Commit log
|
||||||
|
|
||||||
git commit -m "msg" # commit changes with a msg
|
git commit -m "msg" # commit changes with a msg
|
||||||
|
git commit -m "title" -m "description" # commit changes with a title and description
|
||||||
git commit --amend # combine staged changes with the previous commit, or edit the previous commit message without changing its snapshot
|
git commit --amend # combine staged changes with the previous commit, or edit the previous commit message without changing its snapshot
|
||||||
git commit --amend --no-edit # amends a commit without changing its commit message
|
git commit --amend --no-edit # amends a commit without changing its commit message
|
||||||
git commit --amend --author='Author Name <email@address.com>' # Amend the author of a commit
|
git commit --amend --author='Author Name <email@address.com>' # Amend the author of a commit
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ $ end of line
|
|||||||
<enter> move line downwards, on the first non blank character
|
<enter> move line downwards, on the first non blank character
|
||||||
gg go to first line
|
gg go to first line
|
||||||
G go to last line
|
G go to last line
|
||||||
|
ngg go to line n
|
||||||
nG go To line n
|
nG go To line n
|
||||||
:n go To line n
|
:n go To line n
|
||||||
) move the cursor forward to the next sentence.
|
) move the cursor forward to the next sentence.
|
||||||
|
|||||||
Reference in New Issue
Block a user