首页 > 系统相关 >Ubuntu Conf

Ubuntu Conf

时间:2023-09-24 17:11:26浏览次数:42  
标签:jammy restricted Ubuntu Conf ubuntu deb main multiverse

Ubuntu Conf

一键安装脚本需要 sudo 运行

WSL-Ubuntu

一键安装"MyUbuntu.sh":

#!/bin/bash
echo "" > ./errLog
echo "开始初始化!"
echo "更换至『USTC 软件源』..."
mv /etc/apt/sources.list /etc/apt/sources.list.bak > /dev/null 2>>./errLog
echo "
# Tsinghua
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
" > /etc/apt/sources.list
echo "Updating..."
apt update > /dev/null 2>>./errLog
if [[ -z $1 || $1!="-y" ]];then    # 询问是否更新
    read -p "Need upgrade?(Y|N) " opt
    case $(echo "$opt" | tr [A-Z] [a-z]) in
        y|yes)
            ls
            apt -y upgrade > /dev/null 2>>./errLog
            ;;
        n|no)
            echo "No Upgrade"
            ;;
    esac
fi
    
echo "开始安装必要软件..."
if [[ -z $1 || $1!="-y" ]];then    # 询问是否安装
    apt install whatweb nmap dirsearch zsh-autosuggestions hydra
else
    apt install -y whatweb nmap dirsearch zsh-autosuggestions hydra
fi
echo "开始配置zsh..."
chsh -s /usr/bin/zsh > /dev/null 2>>./errLog
mkdir -p ~/Documents/powerlevel10k > /dev/null 2>>./errLog
git clone https://gitee.com/insanemac/powerlevel10k.git ~/Documents/powerlevel10k/ > /dev/null 2>>./errLog
echo "
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r \"\${XDG_CACHE_HOME:-\$HOME/.cache}/p10k-instant-prompt-\${(%):-%n}.zsh\" ]]; then
  source \"\${XDG_CACHE_HOME:-\$HOME/.cache}/p10k-instant-prompt-\${(%):-%n}.zsh\"
fi

# ~/.zshrc file for zsh interactive shells.
# see /usr/share/doc/zsh/examples/zshrc for examples

setopt autocd              # change directory just by typing its name
#setopt correct            # auto correct mistakes
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst     # enable filename expansion for arguments of the form ‘anything=expression’
setopt nonomatch           # hide error message if there is no match for the pattern
setopt notify              # report the status of background jobs immediately
setopt numericglobsort     # sort filenames numerically when it makes sense
setopt promptsubst         # enable command substitution in prompt

WORDCHARS=\${WORDCHARS//\/} # Don't consider certain characters part of the word

# hide EOL sign ('%')
PROMPT_EOL_MARK=\"\"

# configure key keybindings
bindkey -e                                        # emacs key bindings
bindkey ' ' magic-space                           # do history expansion on space
bindkey '^U' backward-kill-line                   # ctrl + U
bindkey '^[[3;5~' kill-word                       # ctrl + Supr
bindkey '^[[3~' delete-char                       # delete
bindkey '^[[1;5C' forward-word                    # ctrl + ->
bindkey '^[[1;5D' backward-word                   # ctrl + <-
bindkey '^[[5~' beginning-of-buffer-or-history    # page up
bindkey '^[[6~' end-of-buffer-or-history          # page down
bindkey '^[[H' beginning-of-line                  # home
bindkey '^[[F' end-of-line                        # end
bindkey '^[[Z' undo                               # shift + tab undo last action

# enable completion features
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*:*:*:*:*' menu select
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' rehash true
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:kill:*' command 'ps -u \$USER -o pid,%cpu,tty,cputime,cmd'

# History configurations
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
setopt hist_ignore_dups       # ignore duplicated commands history list
setopt hist_ignore_space      # ignore commands that start with space
setopt hist_verify            # show command with history expansion to user before running it
#setopt share_history         # share command history data

# force zsh to show the complete history
alias history=\"history 0\"

# configure \`time\` format
TIMEFMT=\$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'

# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval \"\$(SHELL=/bin/sh lesspipe)\"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z \"\${debian_chroot:-}\" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=\$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we \"want\" color)
case \"\$TERM\" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n \"\$force_color_prompt\" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
        # We have color support; assume it's compliant with Ecma-48
        # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
        # a case would tend to support setf rather than setaf.)
        color_prompt=yes
    else
        color_prompt=
    fi
fi

configure_prompt() {
    prompt_symbol=㉿
    # Skull emoji for root terminal
    #[ \"\$EUID\" -eq 0 ] && prompt_symbol=

标签:jammy,restricted,Ubuntu,Conf,ubuntu,deb,main,multiverse
From: https://www.cnblogs.com/Forest-set-you/p/17726240.html

相关文章

  • VituaBox虚拟机安装Ubuntu
    下载虚拟机和Ubuntu1.分别在官网下载所需软件与镜像文件(注意要与自己的系统相匹配)在虚拟机安装Ubuntu1.打开VituaBox,选择新建2.自己设置虚拟电脑名称,选择存储位置3.虚拟机内存大小,CPU核心数以及硬盘大小自己看着设计4.选择打开建好的系统随着步骤开始安装,并设置密码用......
  • 设置ubuntu server 在 virtual box下的分别率
     首先进入virtualbox的ubuntuserver虚拟机,然后通过下面的命令重启系统shutdown-rnow在启动过程中按shift进入GRUB选择菜单,点击c进入命令行, 输入vbeinfo显示可用的分辨率,并记录下来 ......
  • [已解决]报错: Error response from daemon: conflict
    报错内容:Errorresponsefromdaemon:conflict:unabletodeletef5b6ef70d79b(mustbeforced)-imageisbeingusedbystoppedcontainer0a740a8a885c解决办法:先删除容器,再删除镜像删除所有已停止的容器dockerrm$(dockerps-a-q)删除所有镜像dockerrmi$(do......
  • Ubuntu22.04 系统添加中文输入法
    为Ubuntu22.04系统添加中文输入法引用:https://blog.csdn.net/weixin_44916154/article/details/1245823791、首先,安装 Chinese 语言包2、单击桌面右上角图标,点击 Settings,在弹出的窗口中,点击 Region&Language,然后点击 ManageInstalledLanguages3、或者通过这......
  • SpringCloud-Config配置中心搭建保姆级教程
    一、分布式配置中⼼在使⽤微服务架构开发的项⽬中,每个服务都有⾃⼰的配置⽂件(application.yml),如果将每个服务的配置⽂件直接写在对应的服务中,存在以下问题:1.服务开发完成之后,需要打包部署,配置⽂件也会打包在jar⽂件中,不便于项⽬部署之后的配置修改(在源码中修改——重新打包—......
  • Ubuntu中文件编译时gcc的链接参数-lm
    在Terminal中使用gcc编译.c文件时,本以为参数的位置是十分宽松的,比如 -o目标名 与 编译条件 是可以互换位置的。正如此例:将hello.c文件编译成可执行文件hello时,gcc-ohellohello.c与gcchello.c-ohello两条编译命令是等价的。但当遇到代码文件中遇到数学函数时,在......
  • ubuntu开启root用户远程ssh登录
    ubuntu系统初始状态下无法通过ssh登录到root用户,只能先登录普通用户再切换到root用户,本文讲解的是开启root用户远程ssh登录su-root切换到root用户su-root打开ssh配置文件vim/etc/ssh/sshd_config找到 插入 PermitRootLoginyes 保存退出重启ssh服务system......
  • 关于Linux虚拟机输入ifconfig命令没有ens33的解决办法
    首先我遇到的问题是这样的:平时能够正常启动,但是因为昨天在启用vm虚拟机的时候更换了一下网络节点,今天打开虚拟机,finalshell连接不上虚拟机了,输入ifconfig命令也没有ens33查阅相关资料后,发现了遇到这个问题的一个解决方法:1.输入systemctlstopNetworkManager//临时关闭网络2.......
  • redis.conf文件参数说明
    redis.conf文件参数说明‍1、单位(Units)配置大小单位,开头定义了一些基本的度量单位,只支持bytes,不支持bit大小写不敏感#不区分大小写#unitsarecaseinsensitiveso1GB1Gb1gBareallthesame.2、包含(INCLUDES)类似jsp中的include,多实例的情况可以把公用的配置......
  • VirtualBox 安装 Ubuntu
    VirtualBox安装Ubuntu这里我们就以安装虚拟机的方式在我们的电脑上安装Linux操作系统,我们选用Ubuntu作为教程,如果有经济实力,可以在腾讯云、阿里云之类的服务商购买一台云服务器,并选择预装Ubuntu系统;如果你还想搞嵌入式开发之类的工作,可以购买一台树莓派服务器,也可以在上面安装U......