- Linux list directory contents and permissions archive#
- Linux list directory contents and permissions code#
Bash: forcing the process exit code using a subshell.Bash: using timeout to put time limit on invoked commands.Bash: trapping signals during script processing.Bash: identifying and killing a zombie child processes.Bash: automating ssh login and sudo that require interactive login.GCP: enabling Cloud Armor on GCP HTTPS LB for Anthos Service Mesh.GCP: Private GKE Cluster with private endpoint using Terraform.GCP: Private GKE Cluster with Anthos Service Mesh exposing services.
Kubernetes: emptying the finalizers for a namespace that will not delete.Kubernetes: deleting a GKE node from a managed instance node pool.GCP: serving a maintenance page using an HTTPS LB and container native routing.Bash: test both file existence and size to avoid signalling success.GCP: internal HTTPS LB for securely exposing insecure VM services.GCP: global external HTTPS LB for securely exposing insecure VM services.GCP: VM instances running as the Compute Engine default service account.GCP: Deploying a 2nd gen Python Cloud Function and exposing from an HTTPS LB.GCP: Cloud Function to handle requests to HTTPS LB during maintenance.Kubernetes: kustomize overlay to enrich a base resource.
Linux list directory contents and permissions archive#
Rsync dry run (-a) archive recursive (-v) verbose, (-u) skip files newer (-n) dry run $ sudo rsync -aunv sourceDirectory/ destinationDirectory/ Author Fabian Posted on OctoJCategories Linux Tags attributes, cp, linux, metadata, ownership, permissions, preserve, rsync, tar, tree, ubuntu Post navigation You can verify that the ownership, permissions, and modifications dates have been preserved by issuing the commands below and noting they all have the same metadata. Mkdir testtar & tar xvfp myarchive.tar -C testtar Sudo rsync -auvh -progress testp/* testrsync Test each utility described above by typing these commands. This creates a directory named ‘testp’, you can view the owner, permissions, and modifications using ‘ls -l testp/*’ It assigns different levels of permission, ownership, and modifications dates. If you want to run a test, you can use a test script on my github page that creates a directory called ‘testp’, that has owners named bugs, daffy, and michael. When tar’ing with -C the order is important, make sure the “-C” comes first, then the final period. # use sudo to allow setting permissions upon extraction # make sure directory you are extracting to pre-exists Preserve permission (-p) verbose (-v) tar cvfp. Avoid this by suffixing only the source with an ending slash, e.g. If you specify both sourceDir and destDir with an ending slash, the destination will be at an extra level of subfolder. Rsync -e "ssh -i ~/.ssh/sshprivkey" -auvh -progress / : (-a) archive recursive which preserves permissions/time/ownership, (-u) skip files that are newer on the receiver, (-v) verbose, (-h) numbers human readable.
These typically need sudo in order to work.Ĭopy with recursion (-r) and (-p) preserve mode,ownership,timestamps sudo cp -rp File copying is about more than just content – the metadata for user ownership, permissions, and timestamps is often critical to retrieval and function.īelow are the relevant switches for metadata preservation when using cp, rsync, and tar.