mirror of
				https://github.com/sahinakkaya/til.git
				synced 2025-07-17 14:01:49 +03:00 
			
		
		
		
	fix: Add syntax highlighting to code blocks
This commit is contained in:
		| @ -1,5 +1,5 @@ | ||||
| You can use `touch` to change modification date or time of a file: | ||||
| ``` | ||||
| ```bash | ||||
| touch -d 20210703 filename | ||||
|  | ||||
| # Set the times on a file to a specific date and time: | ||||
| @ -7,8 +7,8 @@ touch -t YYYYMMDDHHMM.SS filename | ||||
| ``` | ||||
|  | ||||
|  | ||||
| or use the times from a file to set the times on a second file: | ||||
| ... or use the times from a file to set the times on a second file: | ||||
|  | ||||
| ``` | ||||
| ```bash | ||||
| touch -r filename filename2 | ||||
| ``` | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| You can get the size of a file in bytes with: | ||||
| ``` | ||||
| ```bash | ||||
| stat -c %s file_name | ||||
| # example | ||||
| size=$(stat -c %s $myfile) | ||||
|  | ||||
| @ -1,12 +1,12 @@ | ||||
| You can loop through the files with: | ||||
| ``` | ||||
| ```bash | ||||
| for f in * ; do | ||||
|     echo $f | ||||
| done | ||||
| ``` | ||||
|  | ||||
| If you want to loop through only directories: | ||||
| ``` | ||||
| ```bash | ||||
| for d in */ ; do | ||||
|     echo $d | ||||
| done | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| You can move every file (except the hidden ones) up by one level in the hierarchy with something like this: | ||||
| ``` | ||||
| ```bash | ||||
| for d in */ ; do | ||||
|     mv $d* . | ||||
|     rmdir $d # optional | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| 1. Redirect stdout to one file and stderr to another file: | ||||
|  | ||||
|     command > out 2>error | ||||
|  | ||||
| ```bash | ||||
| command > out 2>error | ||||
| ``` | ||||
| 2. Redirect stdout to a file `out`, and then redirect stderr to stdout: | ||||
|  | ||||
|     command > out 2>&1 | ||||
|  | ||||
| ```bash | ||||
| command > out 2>&1 | ||||
| ``` | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| You can split a string with `cut`: | ||||
|  | ||||
| ``` | ||||
| ```bash | ||||
| foo="hello-world-bye-world" | ||||
| bar=$(echo $foo | cut -d"-" -f2) | ||||
| echo $bar | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Asocia
					Asocia