Linux 当前工作路径名过长


前言

在编译uboot 下载安装 arm-linux-gcc版本时,发现arm-linux-gcc文件名过长,导致当前工作路径名过长,不美观。现象如下:

gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-ranlib
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc-ar
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc-nm
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc-ranlib
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-size
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-dwp
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux$ ls
gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf  gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf.tar.xz
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux$ cd gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf/
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux/gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$

二、解决方案

打开当前用户的.bashrc文件,将图中所示的三个小写w改为大写W。
在这里插入图片描述
修改后如下:

root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux/gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$ vim ~/.bashrc 
 59 if [ "$color_prompt" = yes ]; then
 60     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
 61 else
 62     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
 63 fi
 64 unset color_prompt force_color_prompt
 65 
 66 # If this is an xterm set the title to user@host:dir
 67 case "$TERM" in
 68 xterm*|rxvt*)
 69     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \W\a\]$PS1"
 70     ;;
 71 *)
 72     ;;
 73 esac
 74 
 75 # enable color support of ls and also add handy aliases
 76 if [ -x /usr/bin/dircolors ]; then
 77     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
root@ubuntu-GCP1820-SS:~/xilinx_petalinux/gcc-arm-linux/gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$ source ~/.bashrc 
root@ubuntu-GCP1820-SS:gcc-linaro-11.2.1-2021.10-x86_64_arm-linux-gnueabihf$ 

已解决。
w是当前完整的工作路径;
W是指当前目录。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Linux中,使用cp命令可以复制文件或目录到指定的路径。当要将文件或目录复制到当前路径时,你可以使用"."作为目标路径。这表示当前工作目录。例如,如果你想将文件test.txt复制到当前路径,你可以使用以下命令: cp test.txt . 这将在当前路径下创建一个名为test.txt的副本。请注意,如果当前路径已经存在一个名为test.txt的文件,它将被覆盖。另外,如果你想将一个目录复制到当前路径,你可以使用以下命令: cp -r directory_name . 这将递归地将directory_name目录及其所有子目录复制到当前路径。请确保目标路径后面有一个空格,然后是一个点。这样可以确保将文件或目录复制到当前路径。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [linux基本命令(cp,mv命令)以及绝对路径和相对路径](https://blog.csdn.net/LZW_6688/article/details/118641712)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [linux复制指定目录下的全部文件到另一个目录中,linux cp 文件夹](https://blog.csdn.net/weixin_42312392/article/details/116546501)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值