Comenzi linux uzuale
Posted on: 02-12-2012 by: mihai
Using ZIP / UNZIP to manage archives
1 | zip archivefile1 doc1 doc2 doc3 |
This command creates a file “archivefile1.zip” which contains a copy of the files doc1, doc2, and doc3, located in the current directory.
1 | zip archivefile1 * |
This command creates a file “archivefile1.zip” which contains a copy of all files in the current directory in compressed form. However, files whose name starts with a “.” are not included. The extension “.zip” is added by the program.
1 | zip -r archivefile1 . |
This copies the current directory, including all subdirectories into the archive file.
1 | zip -r archivefile2 papers |
This copies the directory “papers”, located in the current directory, into “archivefile2.zip”.
1 | unzip archivefile1.zip |
This writes the files extracted from “archivefile1.zip” to the current directory.
Using TAR to manage archives
1 | tar cvf alldocs.tar *.doc |
To create an archive using tar, use a command like this, which bundles all the files in the current directory that end with .doc into the alldocs.tar file
1 | tar cvf panda.tar panda/ |
Creates a tar file named panda.tar containing all the files from the panda directory (and any of its subdirectories)
In these examples, the c, v, and f flags mean create a new archive, be verbose (list files being archived), and write the archive to a file.
1 | tar cvzf alldocs.tar.gz *.doc |
To automatically compress the tar file as it is being created, add the z flag.
1 | tar xvf panda.tar |
Extract files from panda.tar. To extract the contents of a tar file, use the x (extract) flag in a command.
1 | tar xvfz panda.tar.gz |
Extract files from panda.tar.gz
c Create a new archive.
t List the contents of an archive.
x Extract the contents of an archive.
f The archive file name is given on the command line (required whenever the tar output is going to a file)
M The archive can span multiple floppies.
v Print verbose output (list file names as they are processed).
u Add files to the archive if they are newer than the copy in the tar file.
z Compress or decompress files automatically.
USERADD GROUPADD USERMOD
1 | useradd -G group-name username |
Adaugă user nou la un grup existent.
1 | usermod -a -G group-name username |
Adaugă un user existent la un grup existent.
1 | useradd -g group-name username |
Adaugă un user nou cu grup primar.
1 | usermod -g group-name username |
Modifică grupul primar al userului.
Categories: Linux




