Windows
开启redis服务
redis-server.exe redis.windows.conf
开启redis客户端
redis-cli.exe -h 127.0.0.1 -p 6379
开启Mongodb服务
c:\software\mongodb\bin\mongod --dbpath c:\data\db
查看ip
ipconfig/all
查看某一端口占用情况
netstat -aon|findstr "8080"
查看进程
tasklist|findstr "14948"
杀死一个进程
taskkill /f /t /im QQ.exe
Springboot
版本
Java
获取当前项目的根目录
System.getProperty("user.dir")
存放一个文件
File destination = new File(rootFilePath);file.transferTo(destination); //上传文件
FileUtil工具
<dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.7.3</version></dependency>
下载一个图片时的接口
public void getFiles(HttpServletResponse response, @PathVariable("flag") String flag){OutputStream os;//创建输出流String basePath = System.getProperty("user.dir") + "/springboot/src/main/resources/files/"; // 上传文件的目录List<String> fileNames = FileUtil.listFileNames(basePath);String fileName = fileNames.stream().filter(name -> name.contains(flag)).findAny().orElse("");try {if (StringUtils.isNotEmpty(fileName)){response.addHeader("Content-Disposition","attachment;filename="+ URLEncoder.encode(fileName,"UTF-8"));response.setContentType("application/octet-stream");byte[] bytes = FileUtil.readBytes(basePath + fileName);os = response.getOutputStream();os.write(bytes);os.flush();os.close();}}catch (Exception e) {System.out.println("文件下载失败");}}
Linux
清理loop
sudo apt autoremove --purge snapd
扩展虚拟机的根目录
https://www.maxlicheng.com/notes/328.html?unapproved=2986&moderation-hash=a582378445672a834c9a180ef5d39f6810
安装dlib时需要root运行
查看ip
ifconfig
查看硬盘使用情况
df -h
Redis
删除当前数据库中所有的key
flushdb
MAC
查看进程号
ps aux |grep process_name
注意
mongod服务不能直接关闭,应该打开另一个控制台使用
db.shutdownServer()
