Results for “Bash Scripts”
Small, practical examples. Search by task or narrow things down below.
Combine a branch’s changes into one new commit
Git: Squash prepares the combined changes in the index without recording a merge parent.
Git✓ Tested
Commit a staged change
Save a focused revision with a descriptive message.
commit✓ Tested
Compress a file and keep the original
Create a gzip-compressed copy of a file while leaving the uncompressed original in place.
gzip✓ Tested
Compress a stream to a chosen filename
Linux Commands: Use gzip -c to leave the source file untouched and choose the destination explicitly.
Linux Commands✓ Tested
Convert a Unix timestamp to UTC
Linux Commands: Use the @ syntax with GNU date for seconds since the Unix epoch.
Linux Commands✓ Tested
Convert tab stops to spaces
Linux Commands: Use expand with a fixed tab width when preparing plain-text alignment.
Linux Commands✓ Tested
Copy a directory while preserving attributes
Linux Commands: Use cp -a for a recursive local copy that preserves links and ordinary file attributes.
Linux Commands✓ Tested
Copy a file to a folder
Create a backup folder if needed, then copy a file into it while preserving its modification time and permission bits.
file✓ Tested
Copy a file with explicit permissions
Linux Commands: Use install to create parent directories and set the destination mode in one operation.
Linux Commands✓ Tested
Correct the latest unpublished commit message
Git: Amend replaces the current commit while preserving its tree when no new changes are staged.
Git✓ Tested
Count bytes in a file
Linux Commands: Use wc -c for byte length rather than Unicode character count.
Linux Commands✓ Tested
Count commits on the current branch
Git: Count commits on the current branch inside the disposable repository created by the input setup.
Git✓ Tested