[英]How can I shorten a path in red hat linux?
So I have a bunch of files that I use for testing in a directory with a long path so say there are 10 files located at /home/grammin/testFiles/program1/important/.
因此,我在一个路径很长的目录中有一堆文件用于测试,因此说
/home/grammin/testFiles/program1/important/.
有10个文件/home/grammin/testFiles/program1/important/.
What I would like to do is have something in my bashrc? 我想做的是在bashrc中有东西吗? maybe that is like
fileDir = /home/grammin/testFiles/program1/important/
and then whenever I would like to access a specific file on the command line all i have to do is type something like ls fileDir/FILE1
. 也许就像
fileDir = /home/grammin/testFiles/program1/important/
,然后每当我想在命令行上访问特定文件时,我要做的就是键入ls fileDir/FILE1
类的东西。 Thanks for the help. 谢谢您的帮助。
you can achive this by ln
command. 您可以通过
ln
命令来实现。 something similar to this 与此类似
ln -s /home/grammin/testFiles/program1/important/ fileDir
Running this one will be enough I think 我认为运行这个就足够了
Just set a variable: fileDir=/home/grammin/testFiles/program1/important
. 只需设置一个变量:
fileDir=/home/grammin/testFiles/program1/important
。
Now ls $fileDir/FILE1
will have the desired effect. 现在
ls $fileDir/FILE1
将具有所需的效果。
You should create a symlink to the path you want, and use the link path as a "typing shortcut" when using terminal. 您应该创建指向所需路径的符号链接,并在使用终端时将链接路径用作“键入快捷方式”。
For example, if you have /this/is/a/very/long/filesystem/path
, you could create the link with ln -s /this/is/a/very/long/filesystem/path pth
and then use ls pth/FILE1
例如,如果您具有
/this/is/a/very/long/filesystem/path
,则可以使用ln -s /this/is/a/very/long/filesystem/path pth
创建链接,然后使用ls pth/FILE1
in your .bashrc file, add importantdir=/home/grammin/testFiles/program1/important/ 在您的.bashrc文件中,添加Importantdir = / home / grammin / testFiles / program1 / important /
Then use that variable with a dollar, eg ls $importantdir/FILE1 然后将该变量与美元一起使用,例如ls $ importantdir / FILE1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.