Linux 1 常用命令(update while learning)

1.登录之后显示$,无法使用table自动补齐,打开bash
bash

2.无法使用ll命令
alias ll=‘ls -alF’

3.删除文件/文件夹
rm -f/rm -rf

4.文件夹重命名A->B
mv A B

5.ftp命令
登录:
ftp hostname port
username
passwd
ftp -> open host

路径:
ftp中用lcd切换本地路径,用cd切换远程服务器的路径。
cd目录名(进入服务器目录) lcd目录名(进入本机目录)
cd \(退到服务器根目录) lcd \(退到本机根目录)
cd …(退回到上一级目录) lcd …(退回到上一级目录)
!dir(显示本机当亲目录内容) dir(显示服务器当前目录内容)

文件:
get filename
put/send filename

6.top
动态查看系统进程运行情况

7.nice
以指定的优先级运行某个进程
nice -9 ./while.py 以9的优先级运行程序
sudo nice --9 ./while.py 以-9的优先级运行程序
renice n PID 修改一个正在运行的进程的优先级

8.ps
ps -A
ps -afx
ps -aux

9.查看内核版本
uname -r

10.查看操作系统版本
cat /proc/version
cat /etc/issue

11.netstat
netstat -in
i:接口
n:ip地址
rn:查看路由(==route)

12.arp -a
查看arp高速缓存

13.arp -d
删除arp高速缓存表项

14.ping

15.tracepath

16.tcpdump -i ens33 -nn icmp
i:接口
nn:网络协议

17.route add
添加路由

18.cat /proc/sys/net/ipv4/ip_forward
查看是否支持路由转发

19.替换文件中的字符串
将当前目录中所有文件中的字符串"src"替换为"sbu1"(区分大小写)
sed -i “s/src/sbu1/g” grep "src" -rl ./
sed -i “s/SRC/SBU1/g” grep "SRC" -rl ./

20.apt-get install packagename
出现E:packagename has no installation candidate
解决:
apt-get update
apt-get upgrade
apt-get install packagename

21.修改默认源(apt-get软件包来源)
安装Ubuntu 18.04后,使用国外源太慢了,修改为国内源会快很多。
修改阿里源为Ubuntu 18.04默认的源
备份/etc/apt/sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.bak
在/etc/apt/sources.list文件前面添加如下条目
添加阿里源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
最后执行如下命令更新源:
sudo apt-get update
sudo apt-get upgrade

另外其他几个国内源如下:
中科大源
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

163源
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse

清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

22.修改ubuntu(16.04以上)默认运行级别
systemctl set-default multi-user.target

23.查看CPU是否支持虚拟化
egrep -o ‘(vmx|svm)’ /proc/cpuinfo
egrep ‘(vmx|svm)’ /proc/cpuinfo

24.安装KVM环境(嵌套虚拟化)
sudo apt-get install -y qemu-kvm qemu-system libvirt-bin virt-manager bridge-utils vlan

25.安装openvswitch
apt-get install openvswitch-switch

26.安装docker
apt install docker.io

27.docker加速
curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://95822026.m.daocloud.io
systemctl restart docker.service

28.ubuntu安装PCRE库
apt-get install libpcre3 libpcre3-dev

### WebGoat Installation and Usage on Linux For installing and using WebGoat on a Linux environment, the process involves several key steps that ensure proper setup of this educational tool designed to teach web application security lessons. #### Prerequisites Before proceeding with the installation of WebGoat, it is necessary to have Java installed since WebGoat runs as a Java application. One can verify if Java is already present by executing `java -version` in the terminal. If not available, install OpenJDK or Oracle JDK depending upon preference[^1]. ```bash sudo apt update && sudo apt install default-jdk ``` #### Downloading WebGoat The latest version of WebGoat should be downloaded from its official GitHub repository or website. This ensures obtaining an up-to-date copy which includes recent fixes and features added by developers. ```bash wget https://github.com/WebGoat/WebGoat/releases/download/8.0/webgoat-server-8.0.jar ``` #### Running WebGoat Once downloaded, running WebGoat requires specifying sufficient heap space for optimal performance during exercises. Use the command below where `-Xmx512m` allocates memory accordingly: ```bash java -jar webgoat-server-8.0.jar --spring.profiles.active=WebGoat ``` This starts the server locally at port 8080 typically unless specified otherwise within configuration files or through additional parameters passed along while invoking java jar file execution. #### Accessing WebGoat Interface After starting successfully without errors, open any modern browser navigating towards `http://localhost:8080/WebGoat`. Here users will find instructions guiding them further into creating accounts before diving straight into learning modules covering various aspects related specifically but not limited only around OWASP Top Ten vulnerabilities found commonly across insecure applications today. #### Configuration Adjustments (Optional) Depending on network settings or requirements outside standard localhost deployment scenarios, adjustments might need making inside properties files located under resources folder bundled together alongside executable JAR archive provided officially via downloads section mentioned earlier above here too.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值