theme: orange
一起养成写作习惯!这是我参与「掘金日新计划 · 4 月更文挑战」的第17天,点击查看活动详情。
Linux 一些实用的操作,纯属工程实践记录,非喜勿喷。
升级Cmake
In the new version of cmake (ex: 3.9.6), to install, download tar file from https://cmake.org/download/. Extract the downloaded tar file and then:
cd $CMAKE_DOWNLOAD_PATH ./configure make sudo make install
也许在配置过程中需要安装 openssl 的编译依赖 sudo apt-get install libssl-dev
也许在安装使用cmake会出现以下问题: pl@honorstone:/usr/local/bin$ cmake --version CMake Error: Could not find CMAKE_ROOT !!! CMake has most likely not been installed correctly. Modules directory not found in /usr/local/share/cmake-3.16 cmake version 3.16.3
缓存问题而已,清空缓存即可。 hash -r
升级gcc
We currently have no info of when we'll see an APT release of GCC 11.1. Below, I show the step-by-step build instructions that you can hopefully follow along:
You can visit https://gcc.gnu.org/mirrors.html, choose the closest mirror to you, download the source for gcc-11.1.0.tar.gz
Then, make sure to have your build system installed:
sudo apt install gcc g++ make bison binutils gcc-multilib
Yes, you need gcc to build gcc.
Then, unpack the tarball:
cd Downloads # replace with your download location tar -xzvf gcc-11.1.0.tar.gz cd gcc-11.1.0
The last thing is to actually build it:
mkdir build cd build ../configure --enable-multilib && make && sudo make install
That's all! You now have GCC 11.1 installed in Ubuntu.
Maybe miss GMP, MPFR, and MPC,you can solve by
Inside the gcc directory, do this command:
./contrib/download_prerequisites
After that script, GMP, MPFR, and MPC will be ready to use. Continue with ./configure
.
remove executable permissions
We could have achieved the same thing without the “a” in the “a+x” statement. The following command would have worked just as well chmod +x <your file name>
We can add the execute permission for everyone with the following command:
chmod a+x new_script.sh
what about removing executable permissions? chmod -R a-x <your file name>
We want the user dave to have read and write permissions and the group and other users to have read permissions only. We can do using the following command: chmod u=rw,og=r new_file.txt
Let’s say we want to remove the read permissions for the “other” users from files that have a “.page” extension. We can do this with the following command: chmod o-r *.page