Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
home_server:home_server_setup:other_services:bash [2024-01-02 Tue wk01 21:44] baumkphome_server:home_server_setup:other_services:bash [2025-08-16 Sat wk33 19:41] (current) – [create] baumkp
Line 368: Line 368:
   * danyspin97's site [[https://danyspin97.org/blog/colorize-your-cli/|Colorize your CLI]]   * danyspin97's site [[https://danyspin97.org/blog/colorize-your-cli/|Colorize your CLI]]
   * [[https://www.gnu.org/software/bash/manual/html_node/index.html#SEC_Contents|Bash Reference Manual]]   * [[https://www.gnu.org/software/bash/manual/html_node/index.html#SEC_Contents|Bash Reference Manual]]
-  * shopt [[https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html|The Shopt Builtin] sh options, simply type ''shopt'' to see list with current settings.  Looks like built ins only?+  * shopt [[https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html|The Shopt Builtin]] sh options, simply type ''shopt'' to see list with current settings.  Looks like built ins only?
   * set [[https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html|The Set Builtin]] set options, ''set'' on its own list entire content. (Looks like user defined?)   * set [[https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html|The Set Builtin]] set options, ''set'' on its own list entire content. (Looks like user defined?)
  
Line 442: Line 442:
 ====create==== ====create====
 main ''tar'' create options, e.g.: ''tar -cvf archive_filename.tar file1 directory1 file2'' main ''tar'' create options, e.g.: ''tar -cvf archive_filename.tar file1 directory1 file2''
-  *''-c'' : for create archive, a pretty self-explanatory option if you want to create a new archive made from the files selected; +  *''-c'' : for create archive, a pretty self-explanatory option if you want to create a new archive made from the files selected.  The ''c'' option should be first.   
-  *''-v'' : for verbose, this is the reason why the command displays the files added to the archive when executing it; +  *''-v'' : for verbose, this is the reason why the command displays the files added to the archive when executing it. 
-  *''-f'' : for file, this option is used in order to specify the filename of the archive we want to create (in this case archive.tar)+  *''-f'' : for file, this option is used in order to specify the filename of the archive we want to create (in this case archive.tar), The ''f'' option should be just before the file name.
  
 +If backing up a root directory use the following as an example: ''sudo tar -czvPf filename /etc'' a better example is ''sudo tar -czvf filename -C / etc''
 +  *''-P'' : for Don't strip leading slashes from file names when creating archives.  This is not recommended as the absolute path will overwrite the information in the root directory, which will often and mostly lead to undesirable outcomes.  This is why the ''tar'' command will usually strip leading absolute path references to root directory, that is paths starting with ''/''.
 +  *''-C'' : for change to directory.  This changes the directory to ''/'' and then copies the files into the archive with relative paths, that is without the leading ''/''
 ====extract==== ====extract====
 ''tar -xvf archive_filename.tar'' ''tar -xvf archive_filename.tar''
Line 452: Line 455:
 ====list contents==== ====list contents====
 ''tar -tvf 'archive filename''' ''tar -tvf 'archive filename'''
 +  *''t'' will list the contents of the archive.
 +  *''v'' will list all the file parameters, without just the file path/name only.
 =====ps process===== =====ps process=====
 ''ps aux'' to see current process ''ps aux'' to see current process
Line 466: Line 471:
   *''xz'', extension ''.xz'', with ''tar'' use flag ''-J''   *''xz'', extension ''.xz'', with ''tar'' use flag ''-J''
  
 +=====copy & paste=====
 +See [[https://wiki.kptree.net/doku.php?id=home_server:home_server_setup:other_services:misc#pbcopy_pbpaste|pbcopy pbpaste]]
 =====Change Default System Editor===== =====Change Default System Editor=====
 Use ''sudo update-alternatives --config editor'' and follow prompts on screen Use ''sudo update-alternatives --config editor'' and follow prompts on screen