Ubuntu - command checklist

只是简单记录我使用的命令,没有什么参考价值,我只是用于整理

chown

chmod permissions filename

Where,

  • permissions can be read, write, execute or a combination of them.
  • filename is the name of the file for which the permissions need to change. This parameter can also be a list if files to change permissions in bulk

We can change permissions using two modes:

  1. Symbolic mode: this method uses symbols like ugo to represent users, groups, and others. Permissions are represented as  r, w, x for read write and execute, respectively. You can modify permissions using +, - and =.
  2. Absolute mode: this method represents permissions as 3-digit octal numbers ranging from 0-7.

How to Change Permissions using Symbolic Mode

The table below summarize the user representation:

USER REPRESENTATIONDESCRIPTION
uuser/owner
ggroup
oother

We can use mathematical operators to add, remove, and assign permissions. The table below shows the summary:

OPERATORDESCRIPTION
+Adds a permission to a file or directory
Removes the permission
=Sets the permission if not present before. Also overrides the permissions if set earlier.

Example:

Suppose, I have a script and I want to make it executable for owner of the file zaira.

Current file permissions are as follows:

Let's split the permissions like this:

df -H

The output of df -H will report how much space is used, available, percentage used, and the mount point of every disk attached to your system 

Ubuntu 查看磁盘空间大小命令 - 水木清扬 - 博客园

如何设置python3.8为默认python的版本

如何查看 pip 指向哪个 python 版本和 package 包的安装路径?

1> 查看pip3链接的版本
$ pip3 -V
pip 21.2.4 from /opt/homebrew/lib/python3.8/site-packages/pip (python 3.8)

2> 修改pip默认使用的Python版本

which pip 查看其路径

sudo vim /usr/local/bin/pip  

#!/usr/bin/python 变成指定的版本。

Steps to Git clone on Ubuntu

git-clone@ubuntu:~$ sudo apt install git
git-clone@ubuntu:~$ git --version
git-clone@ubuntu:~$ git clone https://gitlab.com/cameronmcnz/gitlab-made-easy.git
git-clone@ubuntu:~$ cd my-github-repo
git-clone@ubuntu:~$ git config --global user.email "ubuntu-clone@example.com"
git-clone@ubuntu:~$ git config --global user.name "cameronmcnz"
git-clone@ubuntu:~$ touch my-file.html
git-clone@ubuntu:~$ git add .
git-clone@ubuntu:~$ git commit -m "good commit message"
git-clone@ubuntu:~$ git push origin master

how to create pr open a TXT file

sudo gedit 文件名

error:sudo: gedit: command not found

how to install python3.5 + setuptools+pip

vim: command not found

How to Fix “Vim Command Not Found” Error in Ubuntu

:wq是保存并退出

多python共存,如何设置默认的python版本

2 用户级修改
为某个特定用户修改Python版本,只需要在其home目录下创建一个alias。

step1:打开该用户的~/.bashrc文件:

vim ~/.bashrc

ps:如果没有vim,就看上面一个link,安装下vim就好了,

step2:添加新的别名来修改默认Python版本:

alias python='/usr/bin/python3.5'

PS:我要设置的默认版本是python3.5.这里的path是python3.5的路径,我的在local中,

step3:重新登录或者重新加载.bashrc文件,使操作生效:

$ . ~/.bashrc  


step4:检查当前的Python版本:

$ python --version

这里就会显示python 3.5.0,就是成功了。
 

这个并不是系统级的修改,系统级的修改可以参考:【Python】Ubuntu修改默认Python版本_remo0x的博客-CSDN博客_ubuntu 更换python版本

ImportError: cannot import name 'HTTPSHandler'

step1: 复制一个文件过来

复制3.9版本中的ssl.so到3.5版本中,但是复制的文件应该是适应3.9的,而不是3.5的,只需要改名就可以了吗?根据下面的文章是这样的,但是我认为不是,还在尝试,我尝试了,修改文件名字是没有用的,可能不兼容

https://blog.csdn.net/jaket5219999/article/details/120805605场景:Mac电脑之前已经通过源码安装了Python3.8,一切都是正常。为了试验asyncio.to_thread方法,又通过源码安装了Python3.9,安装成功之后,创建虚拟环境,发现pip不能用,报错如下```WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to Hhttps://blog.csdn.net/jaket5219999/article/details/120805605

step2: 尝试安装openssl,参考下面文章的方法,常规的操作,但是尝试后发现并没有安装上。openssl安装与使用_WuYuJun's blog的博客-CSDN博客_openssl文章目录1、OpenSSL简介2、 OpenSSL安装3、加密技术介绍4、openssl 命令4.1摘要命令4.2、对称加密命令4.3非对称加密命令4.3.1生成私钥4.3.2提取公钥4.3.3利用公私钥加密、解密数据4.3.4 数字签名4.3.5数字证书1、OpenSSL简介OpenSSL是一个SSL协议的开源实现,采用C语言作为开发语言,具备了跨平台的能力,支持Unix/Linux、Windows、Mac OS等多种平台。  OpenSSL最早的版本在1995年发布,1998年后开始由OpenShttps://blog.csdn.net/caijiwyj/article/details/106840234?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522167566808016800213040362%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=167566808016800213040362&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~top_positive~default-1-106840234-null-null.142%5Ev73%5Econtrol,201%5Ev4%5Eadd_ask,239%5Ev1%5Einsert_chatgpt&utm_term=openssl&spm=1018.2226.3001.4187

ImportError: No module named _ssl

python - ImportError: No module named _ssl - Stack Overflow

报错信息是

(base) ubuntu@gpu-ws:~$ sudo yum install openssl-devel
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>

yum 相当于是sudo apt-get,因此只需要尝试使用该命令进行安装就可以了。

step2:

修改python的module中的Setup.dist文件,不要注解SSL部分,重新编译该文件,安装python,会在安装python成功后,直接将该包安装成功。

https://blog.csdn.net/xiemanR/article/details/85224509

python卸载 - ubuntu

常见指令失效,报错信息是: Package 'libpython3.5-minimal' is not installed, so not removed

Ubuntu卸载python(慎重)_痴迷、淡然~的博客-CSDN博客_ubuntu卸载了python

brew安装后无法使用,

其他人在服务器中安装了brew,但是我登录后,却显示是no command,然后我查找资料,发现可能是安装后没有激活,或者说是配置环境,然后参考这个文章,尝试配置环境,但是我找不到其他人配置的路径,但是我看了一个/home处输入.bash_profile后,看到了有两个配置信息,不知道是谁配置的,由于我也无权利修改该文件,只能搁置。然后我上了brew官网又重新安装了一下。但是输入那个命令后,我还是找不到安装路径,但是输入brew确实是可以使用了。

Mac系统下安装Homebrew后无法使用brew命令 - 简书

删除文件/文件夹

实例:

删除文件夹实例:

rm -rf /var/log/httpd

这句代码的意思是:删除/var/log/httpd目录以及其下所有文件、文件夹

删除文件实例:

rm -f /var/log/httpd/access.log

这个将会强制删除/var/log/httpd/access.log这个文件

复制文件

cp 要复制文件的path 目的path

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值