ubuntu和petalinux常用命令 cnpmjs bt.ly j.mp

  • Post author:
  • Post category:linux




打开命令行、拷贝 unstall 系统备份dpkg –get-selections |grep firefox

压缩虚拟机方法:sudo vmware-toolbox-cmd disk shrink /

window下进入命令行快捷键“WIN+shift+s”即可截图;

window下进入命令行快捷键“WIN+R”即可打开终端窗口;

linux下进入命令行快捷键“Ctrl+Alt+T”即可打开终端窗口;

输入uname – a,lsb_release -a, cat /etc/issue

在root下创建一个root, 将原来的root下的内容全部拷贝过来

john@john-virtual-machine:~/ultra96$ sudo cp -r /home/john/ultra96/root/root/root /media/john/root/root

若dir2存在,则用下面的命令

cp -r dir1/. dir2

去锁 sudo chown 用户名 文件夹/ -R

没有光标,输入命令 echo -e “\033[?25h”

tar -cvpzf /backup.tar.gz –exclude=/tmp –exclude=/backup.tar.gz –exclude=/sys –exclude=/proc –exclude=/lost+found –exclude=/tmp /

sudo tar -zcvf /home/john/petalinux_project/kv260_image/root/rootfs.tar.gz ./

sudo tar -zxvf /home/john/petalinux_project/kv260_image/root/rootfs.tar.gz -C /media/john/root

sudo tar –skip-old-files -zxvf root2511.tar.gz -C ./dec7c1d5-55e1-4223-abfd-13a587eaadfa1

zip -r test.zip tmb/

unzip -o test.zip -d tmp/

dpkg –get-selections |grep firefox

sudo apt-get purge all packages above

netsh interface ip set address “WLAN” static 192.168.1.10 255.255.255.0 192.168.0.1 1

netsh interface ip set address “以太网” static 192.168.86.10 255.255.255.0 192.168.86.1 1

我的PYNQ Z2用户名密码均为xilinx,IP地址192.168.0.99

我的Ultra96用户名root, 密码xilinx, IP地址192.168.1.15

cat /etc/issue 查看系统版本

cat /etc/lsb-release 查看 Ubuntu 版本信息 cat /proc/version 查看 Linux 核心、GCC 版本信息

root@xilinx-zcu104-2021_2:~# service networking restart

root@xilinx-zcu104-2021_2:~# /etc/init.d/networking restart

root@xilinx-zcu104-2021_2:~/Vitis-AI/demo/VART# wget https://www.xilinx.com/r2.0.0_image_video.tar.gz –no-check-certificate

PS C:\xilinx\boot cp> scp 50-cloud-init.yaml ubuntu@192.168.86.110:/home/ubuntu

sudo -H rm ~/.config/geany/geany_socket_*



查找

看磁盘 df -h

看文件夹 du -sh

find . -type d

find . -type d -name src

find . -type d -maxdepth 1

find ./ -name “*.txt” | xargs grep “Base”

ls -l | grep ‘^d’

ls -F | grep “/



g

r

e

p

e

l

f

M

a

k

e

f

i

l

e

t

r

e

e

L

2

t

e

e

t

r

e

e

.

t

x

t

d

p

k

g

q

u

e

r

y

W

s

h

o

w

f

o

r

m

a

t

=

” grep “elf” Makefile tree -L 2 | tee tree.txt dpkg-query -W –showformat=’









g


re


p





e


l


f





M


ak


e


f


i


l


e


t


ree













L


2∣


t


ee


t


ree


.


t


x


t


d


p


k


g













q


u


ery













W
















s


h


o


w


f


or


ma


t





=

























{Installed-Size} ${Package} ${Status}\n’|grep -v deinstall|sort -n|awk ‘{print $1” “$2}’

https://blog.csdn.net/hobertony_7/article/details/45147473

在这里插入图片描述

ls -F | grep “/$” | grep “rc”

find . -type d -name “*src”

在这里插入图片描述

通过命令du -h –max-depth=1 *,可以查看当前目录下各文件、文件夹的大小,这个比较实用。

如果只想查看指定目录的总大小,可以使用du -sh 目录名称。

加-i 参数直接用 {}就能代替管道之前的标准输出的内容;

find . -type f -name “

.log” | xargs -i cp {} /tmp/k/

加 -I 参数 需要事先指定替换字符。

find . -type f -name ”

.log” | xargs -I {} cp {} /tmp/n/

ls | tail -11| xargs -i cp -r {} /tmp/

拷贝最后11个文件到根目录的/tmp/下(如要拷贝头5个文件,则将tail -11 换成 head -5)

ls | head -1999 | xargs -i cp -r {} ../holdout_images
ls | head -1999 | xargs -i cp -r {} ../val
ls ../holdout_images/*.JPEG | head -10 | xargs -i cp -r {} .

john@john-virtual-machine:~/ultra96v2DPU/build/downloads$ ll -d git2

drwxr-xr-x 97 john john 20480 4月 20 01:52 git2/

echo ‘source

/petalinux2019.2/settings.sh’>>

/.bashrc



petalinux


拷入SD文件


petalinux-package –boot –format BIN –fsbl images/linux/zynq_fsbl.elf –fpga images/linux/system.bit –u-boot –force

sudo cp images/linux/{BOOT.BIN,image.ub,system.dtb} /media/john/BOOT

sudo rm -r /media/john/root/*

sudo tar -zxvf images/linux/rootfs.tar.gz -C /media/john/root

file:///mnt/hgfs/downloads_2019.2/downloads

/mnt/hgfs/sstate_aarch64_2019.2/aarch64

petalinux-create -t project -n ultra96v2DPU -s ./ultra96v2_petalinux2019.2.bsp

petalinux-create -t project -n kv260_2021 -s ./xilinx-k26-som-v2021.2-final.bsp

petalinux-create -t project -n petalinux –template zynqMP

petalinux-package –bsp -p –output MY.BSP

petalinux-package –boot –fsbl zynqmp_fsbl.elf –u-boot u-boot.elf –pmufw pmufw.elf –fpga system.bit –force

vivado -mode tcl

ls -al /bin/sh

sudo rm /bin/sh

ln -s /bin/bash /bin/sh

ls -al /bin/sh

出现不能启动,可能是SD损坏,不一定是程序问题

sudo fdisk –list

umount /media/john/root (不要加sudo)

sudo fsck.ext4 -y /dev/sdb2

sudo rm -r /media/john/rootfs

grep “dpu” *.dtsi
在这里插入图片描述

xilinx@pynq:~$ cat /proc/version

Linux version 4.19.0-xilinx-v2019.1 (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Sat Oct 12 00:54:10 UTC 2019

xilinx@pynq:~$ uname -a

Linux pynq 4.19.0-xilinx-v2019.1 #1 SMP Sat Oct 12 00:54:10 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

xilinx@pynq:~$ lsb_release -a

No LSB modules are available.

Distributor ID: pynqlinux

Description: PYNQ Linux, based on Ubuntu 18.04

Release: v2.5

Codename: glasgow

sudo dpkg-reconfigure bash

sudo apt-get update

echo ‘source

/petalinux2019.2/settings.sh’>>

/.bashrc

ls -al /bin/sh

sudo rm /bin/sh

ln -s /bin/bash /bin/sh

ls -al /bin/sh

should now point to bash



镜像操作

docker images

docker ps -a 命令是用来展示所有的容器,包括未运行的容器

docker image ls

docker stop ID

docker rm ID

docker rmi -f ID

docker ID name/name

john@john-wang:~/Vitis-AI_1.2$ docker save -o cpu.tar xilinx:cpu

john@john-virtual-machine$ docker load -i /mnt/hgfs/xilinx/cpu.tar

docker commit [选项] <容器ID或容器名> [<仓库名>[:<标签>]]

john@john-wang:~/Vitis-AI_1.2$ docker commit -p funny_kepler xilinx:gpu

docker commit 容器必须是停止的吗?docker容器自己提供有commit的功能,如果Docker commit 将容器保存为一个新的镜像,是要先退出容器的。

我认为既可以退出保存,也可以用-p暂停保存,暂时只试了-p保存。

在这里插入图片描述

在这里插入图片描述



python dos操作

os.getcwd()

更改当前目录

os.chdir()

os.listdir(.)

jupyter nbconvert –to script smartcam_file.ipynb



A program like MobaXTerm for Linux systems (SFTP GUI browser & terminal)

https://snapcraft.io/install/snowflake/ubuntu

sudo apt update

sudo apt install snapd

sudo snap install snowflake



镜像


github镜像


git clone https://github.com/pjreddie/darknet.git 用下面的代替

git clone https://github.com.cnpmjs.org/pjreddie/darknet.git

git clone https://gitclone.com/github.com.cnpmjs.org/pjreddie/darknet.git


清华镜像源


命令行执行完事

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple


修复磁盘


john@john-virtual-machine:/media/john$ sudo umount /dev/sdb2

john@john-virtual-machine:/media/john$ sudo e2fsck -y /dev/sdb2

snap install –classic notepadqq



cache所在位置和清除

john@john-virtual-machine:/$ sudo find /home -size +2000000k

/home/john/.cache/vmware/drag_and_drop/FQwSfJ/0325.tar.gz

/home/john/.cache/vmware/drag_and_drop/gnygAD/downloads_2020.2.tar.zip.002

/home/john/.cache/vmware/drag_and_drop/gnygAD/downloads_2020.2.tar.zip.001

cd /home/john/.cache/vmware/drag_and_drop/gnygAD

john@john-virtual-machine:~/.cache/vmware/drag_and_drop/gnygAD$ ll

total 16693264

drwx—— 2 john yxg 4096 4月 11 15:39 ./

drwx—— 45 john yxg 4096 4月 11 14:20 …/

-rwxrw-rw- 1 john yxg 8546942976 4月 11 14:30 downloads_2020.2.tar.zip.001*

-rwxrw-rw- 1 john yxg 8546942976 4月 11 14:30 downloads_2020.2.tar.zip.002*


OPENCV版本


pkg-config –modversion opencv

netsh interface ip set address “以太网” static 192.168.5.10 255.255.255.0 192.168.5.1


python print


print(‘{0},{1}’.format(‘zhangk’, 32))

print(‘{},{},{}’.format(‘zhangk’,‘boy’,32))

print(‘{name},{sex},{age}’.format(age=32,sex=‘male’,name=‘zhangk’))

PI=3.1415926

print(“PI=%.

f”%(3,PI))

#用

从后面的元组中读取字段宽度或精度,可以读取出来精度是3位

#PI=3.142

#没有指定宽度,所以不需要缩进

print(“PI=%

.3f”%(10,PI)) #精度为3,总长为10.

#PI= 3.142

#

所处的位置不同,读取的内容也不同

PI=3.1415926

print(‘%-10.3f’ %PI) #左对齐,还是10个字符,但空格显示在右边。

#3.142

pip3 –trusted-host pypi.python.org install tensorflow

xilinx-k26-starterkit-2021_1:/etc/network$ sudo vi interfaces

auto eth0

iface eth0 inet static

address 192.168.86.27

gateway 192.168.86.1

netmask 255.255.255.0

dns-nameservers 8.8.8.8



版权声明:本文为u010879745原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。