Ubuntu
apt
apt update
apt upgrade
apt upgrade <package-name>
apt install <package-name>
apt install --reinstall <package-name>
ls & cd
ls -o
ls -a -o
cd
cd ..
cd -
ln
search files
which <command>
Where does this command come from?
whereis <command>
locate the binary, source, and manual page files for a command
locate <file name>
search file according mlocate.db
, not alive.
sudo updatedb
update mlocate.db
find <path> -name <file name>
find / -mtime -30 -print
find all files that had their modification time changed in the last 30 days
find /home -name <files> -exec gedit {} \;
find all in home directories and open them with gedit
file’s operations
mkdir <dirname>
touch <filename>
echo "line 1" > <filename>
echo "line 2" >> <filename>
cat <file>
output file’s contents
chmod +x ./<filename>
cp <from file1> <to file2>
cp -R <from Directory1> <to Directory2>
mv <from path/name> <to path/name>
moving and renaming files and directories.
ln -s <file> <link name>
soft link
ln <old file> <new file>
hard link
zip -q -r <filename> <path>
head
teil
tar cvzf <tarball.tar.gz> <directory>
分卷压缩
tar -czf - proc | split -b 2m -d - proc.tar.gz
split proc.tar.gz -b 2m -d proc.tar.gz
#基本同上,只是生成的小文件名前缀是自定义的,为:proc.tar.gz00、proc.tar.gz01等
解压:
解压xxx.tar.gz00 xxx.tar.gz01 xxx.tar.gz02 xxx.tar.gz03 xxx.tar.gz04 ……先用以下命令合并
cat xxx.tar.gz* >>xxx.tar.gz
然后用tar -vzxf xxx.tar.gz
解压
Git
git init
git add .
git commit -m "first commit"
git remote add <name1> <url>
git push -u <name1> <branch>
git pull <name1> <branch> --allow-unrelated-histories
git branch
git branch <new branch>
git switch <branch name>
git remote add <name1> <server url>
git merge <branch1>
current branch will be merged with branch1
git merge <branch> <branch1>
folder name is not important for git
header means on which branch we are working
remote don’t have to be same with local Repo
GPU
nvidia-smi --loop=2
check gpu status every two second
tmux
process can keep running when terminal is closed.
other
echo $<ENV-VAR>
echo $0
check which shell is using
history
locate <name>
whereis <name>
<name> --version
gnome-terminal -- <command>
pip install <name>
pip uninstall <name>
grep <string> <string or filename>
grep -i <string> <string or filename>
printenv
git clone <link>
ps
the process, which are running in the current Shell
ps -ef
all running process
du -sh <Directory>
size of Directory
sudo nautilus
[command] | tee [file]
file are overwrite
[command] | tee -a [file]
append information to the file.
[command] | tee -a [file] | [command]
write output to files, but also to pass on the output as input to other commands
wget http://example.com/folder/file
Dateidownload
kill $(pgrep -f <processname>)
source <filename>
reads and executes commands from filename in the current shell environment
source <*.bash>
mount
unmount
Shift
+ Ctrl
+ T
Alt
+ 1~9
Shift
+ Ctrl
+ W
|
||
execute the second command only if the first returns some value corresponding to “false”
&
&&
execute the second command only if the first success
ROS
catkin
catkin_make
catkin_make_isolated
catkin_create_pkg <pkg-name> <deps-name1> <deps-name2>
ros
echo $ROS_PACKAGE_PATH
rospack depends1 <pkg-name>
<name> --version
roscd <pkg-name>
rosls <pkg-name>
rosrun <pkg-name> <pkg-name>
roscore
rosnode list
rosnode info /<name>
roswtf
rostopic list -v
rostopic echo <topic-name>
rostopic type <topic-name>
rosmsg show <msg_type>
rostopic pub -1 <topic-name> <msg_type> -- [Args]
rostopic pub <topic-name> <msg_type> -r 1 -- [Args]
rqt
rqt_graph
rosrun turtlesim turtlesim_node
rosrun turtlesim turtlesim_node __name:=<a name>
rosrun turtlesim turtle_teleop_key
rosrun rqt_graph rqt_graph
rosrun rqt_plot rqt_plot
rosservice list
print information about active services
rosservice call
call the service with the provided args
rosservice type
print service type
rosservice type /<name> | rossrv show
get input and output of a service
rosparam list
rosparam set [param_name]
rosparam get [param_name]
rosparam dump [file_name] [namespace]
rosparam load [file_name] [namespace]
rosmsg
rossrv
roscp