How to checkout from CVS and specify the local directory name - directory

When I do something like this:
cvs -z3 -d :pserver:anoncvs#sourceware.org:/cvs/src co gdb
... cvs creates a directory 'src' at the path where it is called from, and checks out all the files from cvs/src in there..
In svn, you can do something like (pseudocode)
svn co http://.../TheProject LocalProjectName
... in which case, svn creates a directory 'LocalProjectName' at the path where it is called from, and checks out all the files from .../TheProject in there..
Is there a similar option for cvs (so that the top-level local directory has a different name from that in the repository?)
Thanks in advance for any answers,
Cheers!

cvs co -d LocalProjectName TheProject
This will check out a repository named TheProject into a directory named LocalProjectName.

Related

Add new directory within subdirectory using CVS

How does one add a new directory within a subdirectory using a CVS repository?
cvs add [new_dir_name]
simply creates a new directory on the first level of the repository, while going into the subdirecory I am interested in and adding does not work. i.e.L
cd repository/directory
cvs add [new_dir_name]
Produces an error:
cvs [add aborted]: there is no version here; do 'cvs checkout' first
(This error message, though, still happens when I check out the repository).
Any ideas how to do this?
cd repository
mkdir a
mkdir a/b
mdkdir a/b/c
cvs update -d a/b/c ( not sure if in one go works, if not, try one after another)
The option -d will create directories that are missing. The same should work for add, if you cvs update afterwards and commit to persist it.
Personally I would use git or svn - changed from cvs ~10y ago
You must add each directory in the path to the final subdirectory that is not present on the server in descending oder.
For example...
If you are in the root of your cvs repository, the following should work.
mkdir -p dirname/subdirname
cvs add dirname
cvs add dirname/subdirname
alternately / equivalently
mkdir -p dirname/subdirname
cvs add dirname
cd dirname
cvs add subdirname

Symlink dotfiles

I am having trouble symlinking dotfiles. I have a folder in my home directory ~/dotfiles which I have synced to a github repo. I am trying to take my .vimrc file in ~/dotfiles/.vimrc and create a symbolic link to put it at ~/.vimrc. To do this I type in
ln -s ~/dotfiles/.vimrc ~/.vimrc
But when I run that it says
ln: /Users/me/.vimrc: File exists
What am I doing wrong?
That error message means that you already have a file at ~/.vimrc, which ln is refusing to overwrite. Either delete the ~/.vimrc and run ln again or let ln delete it for you by passing the -f option:
ln -s -f ~/dotfiles/.vimrc ~/.vimrc
There is a better solution for managing dotfiles without using symlinks or any other tool, just a git repo initialized with --bare.
A bare repository is special in a way that they omit working directory, so you can create your repo anywhere and set the --work-tree=$HOME then you don't need to do any work to maintain it.
Approach
first thing to do is, create a bare repo
git init --bare $HOME/.dotfiles
To use this bare repo, you need to specify --git-dir=$HOME/.dotfiles/ and --work-tree=$HOME, better is to create an alias
alias dotfiles='/usr/bin/git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME
At this point, all your configuration files are being tracked, and you can easily use the newly registered dotfiles command to manage the repository, ex :-
# to check the status of the tracked and untracked files
dotfiles status
# to add a file
dotfiles commit .tmux.conf -m ".tmux.conf added"
# push new files or changes to the github
dotfiles push origin main
I also use this way to sync and store my dotfiles, see my dotfiles repository and can read at Storing dotfiles with Git where I wrote about managing for multiple devices.
How to symlink all dotfiles in a directory recursively
Have a dotfiles directory that is structured as to how they should be structured at $HOME
dotfiles_home=~/dotfiles/home # for example
cp -rsf "$dotfiles_home"/. ~
-r: Recursive, create the necessary directory for each file
-s: Create symlinks instead of copying
-f: Overwrite existing files (previously created symlinks, default .bashrc, etc)
/.: Make sure cp "copy" the contents of home instead of the home directory itself.
Tips
Just like ln, if you want no headache or drama, use an absolute path for the first argument like the example above.
Note
This only works with GNU cp (preinstalled in Ubuntu), not POSIX cp. Check your man cp, you can install GNU coreutils if needed.
Thanks
To this and this.

zipping the files in unix having extension after

I have a logs file at directory cd /opt/app/logs named as
coa.log.1
uoa.log.2
erete-rere.log.1
now my concern is that i am looking for unix command which will zip the files having extension log.1 or log.2 or having log. extension anything
request you to please advise the unix comand to zip these files
Folks please advise for this
You can compress in a lot of formats in unix. The most commom is the tar.gz extension. If you are looking fot .zip specifically, there is a zip command: zip <zipname> <files>
To pass the file list you may use the * wirldcard, indicating any name. For example: *.log.*, as sugested by glen, will match every file that contains .log. in its name.
You probably want something like this:
zip backup_logs.zip /opt/app/logs/*.log.*
This will zip all files in the folder that matched what you asked and create a zip file in your current directory.

Unzipping a folder( not empty ) to a new named folder

I have a folder called newfast.zip in my remote server. I required to unzip as xyz folder. ( say xyz is my new folder name ), I tried like this:
[xxxxx#xxxxxautosuggest unzip]$ unzip newfast.zip xyz
Archive: newfast.zip
caution: filename not matched: xyz
[mohamear#stic-scm-autosuggest unzip]$ cl
But I turn with error. any one help me here please?
And any one suggest me the good tutorial page to learn all useful command of putty
Suggested work around: Create a directory, lets say zipcontent and then unzip the content into that dir: unzip file.zip -d zipcontent/
Suggested workaround: Unzip the folder to whatever it unzips to and rename it afterwards.

What is the differences between real so file and ln -s

for example, my directory like this:
lib
|
+--foo.so
+--bar.so -> bar.so.1.0.0.0
+--bar.so.1.0.0.0
Are these both ways always same?
The reason I ask this question is that I found unix will copy to real so file when I
cp -r lib /path/to/
new directory like this:
/path/to/lib
|
+--foo.so
+--bar.so
+--bar.so.1.0.0.0
The difference between so and ls -s is the difference between a file and a symbolic link. Symbolic links are like aliases to other files and operations on them result in changes in the linked files. When you do cp, it copies the linked file to the target directory with the link name as the file name, i.e., it reads the linked file when it opens the symbolic link to copy it. So lose the link and instead get a copy of the linked file. If you use -P option of the cp command you can preserve the symbolic link information.
cp -P lib /path/to/

Resources