Debian创建.desktop文件(Create .desktop file in Debian/Gnome)

本文详细介绍了在Debian系Linux中,如何手动编辑和创建.desktop文件,以便将应用程序如IDEA、burpsuite和JD-GUI添加到系统菜单及dockerbar中,实现快速启动。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Debian系Linux中,用于标识应用的启动文件.desktop file是位于/usr/share/applications目录下的,Gnome会将这些文件在菜单中展示为启动图标,也可以固定在docker bar。

打开/usr/share/applications,可以看到有很多的.desktop文件,每一个文件就对应菜单中的一个启动图标。

如何手动编辑和制作这样一个.desktop文件呢,这里以IDEA集成开发环境为例。
我的IDEA安装在/opt/idea-IC-182.4505.22/目录,IDEA的启动脚本是/opt/idea-IC-182.4505.22/bin/idea.sh。打开/opt/idea-IC-182.4505.22/目录,还可以看到IDEA的图标文件/opt/idea-IC-182.4505.22/bin/idea.png

所以我们在/opt/idea-IC-182.4505.22/目录下创建IDEA.desktop文件,内容如下:

1
2
3
4
5
6
7
8
9
[Desktop Entry]
Name=IDEA
Encoding=UTF-8
Exec=/opt/idea-IC-182.4505.22/bin/idea.sh
Icon=/opt/idea-IC-182.4505.22/bin/idea.png
StartupNotify=false
Terminal=false
Type=Application
#Categories=

再将IDEA.desktop通过软链接添加到/usr/share/applications目录即可。

1
ls -s /opt/idea-IC-182.4505.22/IDEA.desktop /usr/share/applications/IDEA.desktop

再次打开菜单,即可看见创建的启动图标。如果看不到,可以先注销,再重新登录即可。

再分享两个常用的.desktop文件:

burpsuite(可用在kali上)

1
2
3
4
5
6
7
8
9
10
[Desktop Entry]
Name=burpsuite-pro-2
Encoding=UTF-8
Exec=sh -c "java -Xbootclasspath/p:/opt/burpsuite_pro_2.0.09/burp-loader-keygen.jar -jar /opt/burpsuite_pro_2.0.09/burpsuite_pro_v2.0.09beta.jar"
Icon=kali-burpsuite.png
StartupNotify=false
Terminal=false
Type=Application
#Categories=03-webapp-analysis;03-06-web-application-proxies;
X-Kali-Package=burpsuite

JD-GUI

1
2
3
4
5
6
7
8
9
10
[Desktop Entry]
Name=JD-GUI
Encoding=UTF-8
Exec=sh -c "java -jar /opt/jd-gui-1.4.0/jd-gui-1.4.0.jar"
Icon=/usr/share/icons/hicolor/128x128/apps/jd-gui.png
StartupNotify=false
Terminal=false
Type=Application
#Categories=03-webapp-analysis;03-06-web-application-proxies;
Name[en_US]=JD-GUI
 

转载于:https://www.cnblogs.com/xunbu7/p/10844112.html

给我翻译To set up VNC on Debian, you can follow these steps: Install a desktop environment if you haven't already done so. For example, you can install GNOME by running the command sudo apt-get install gnome-core. Install the VNC server software. One popular option is TigerVNC. You can install it by running the command sudo apt-get install tigervnc-standalone-server. Configure the VNC server. You can do this by creating a configuration file in the directory /etc/systemd/system. For example, you can create a file called vncserver@.service with the following contents: 复制 [Unit] Description=Start TigerVNC server at startup After=syslog.target network.target [Service] Type=forking User=%i ExecStart=/usr/bin/vncserver :1 -geometry 1280x800 -depth 24 -dpi 96 ExecStop=/usr/bin/vncserver -kill :1 [Install] WantedBy=multi-user.target This configuration will start the VNC server on display 1 with a resolution of 1280x800, a color depth of 24 bits, and a DPI of 96. You can modify these settings to suit your needs. Enable and start the VNC server. You can do this by running the following commands: 复制 sudo systemctl enable vncserver@:1.service sudo systemctl start vncserver@:1.service This will enable the VNC server to start automatically at boot time, and start the server immediately. Connect to the VNC server. You can use any VNC client software to connect to the server. For example, you can use RealVNC or TightVNC. Just enter the IP address of the Debian machine and the display number (in this case, :1) to connect.
06-11
<think>好的,我现在需要帮助用户解决在Debian系统中卸载桌面环境的问题。用户已经执行了`ls /usr/share/xsessions/`命令,并显示了四个GNOME相关的桌面会话文件gnome-classic.desktopgnome.desktopgnome-classic-xorg.desktopgnome-xorg.desktop。用户可能是在确认已安装的桌面环境,或者在准备卸载GNOME桌面。 首先,我需要确定用户的具体需求。根据用户之前的提问历史,他们询问过如何卸载桌面环境,现在提供了命令输出结果,可能是希望得到进一步的指导。用户可能已经按照之前的步骤操作,现在需要确认如何正确卸载GNOME桌面,或者遇到了问题。 接下来,我需要回顾之前提供的卸载步骤,确保当前回答的一致性。之前的步骤包括确定已安装的桌面环境、卸载核心组件、移除关联应用组、清理依赖项、禁用图形登录管理器、切换运行级别等。现在用户显示的结果是GNOME相关的文件,说明系统安装的是GNOME桌面环境,可能需要具体针对GNOME的卸载命令。 需要检查用户提供的输出,确保卸载步骤中的软件包名称正确。例如,用户系统中有gnome.desktopgnome-xorg.desktop,可能涉及不同的显示服务器(Xorg和Wayland)。可能需要建议用户同时移除gdm3显示管理器,并清理相关配置。 另外,用户可能在执行过程中遇到了问题,例如某些包无法卸载,或者卸载后仍有残留。需要提醒用户注意依赖项清理,使用`autoremove --purge`,并手动删除配置文件。同时,用户可能不知道如何切换运行级别或禁用显示管理器,需要给出具体命令。 还要考虑用户可能的后续需求,例如卸载后如何恢复到命令行界面,或者安装其他桌面环境。需要提供完整的卸载步骤,并给出注意事项,比如重要软件包的保留,避免误删系统关键组件。 最后,确保回答清晰,步骤明确,避免使用复杂术语,让用户能够逐步跟随操作。同时提醒用户操作的风险,建议备份重要数据,并在必要时进行模拟卸载测试。</think>根据您提供的`/usr/share/xsessions/`目录内容,系统当前安装了**GNOME桌面环境**。以下是针对该环境的完整卸载指南: --- ### **分步卸载流程** 1. **卸载核心组件** ```bash sudo apt purge gnome-shell gnome-session gdm3 ``` 2. **移除扩展组件**(含经典模式/Xorg支持) ```bash sudo apt purge gnome-classic-session gnome-session-xorg ``` 3. **清理关联应用组** ```bash sudo apt purge gnome-* # 移除所有GNOME相关软件包 sudo apt purge gdm* # 清理显示管理器残留 ``` 4. **深度清理依赖** ```bash sudo apt autoremove --purge ``` 5. **禁用图形界面服务** ```bash sudo systemctl disable gdm3 && sudo systemctl stop gdm3 ``` 6. **切换默认启动模式** ```bash sudo systemctl set-default multi-user.target ``` --- ### **补充说明** 1. **残留配置清理**: ```bash # 删除用户级配置 rm -rf ~/.config/gnome* ~/.local/share/gnome* # 清理系统级配置(谨慎操作!) sudo rm -rf /etc/gdm3/ ``` 2. **特别注意事项**: - 该操作将移除包括`gnome-terminal`、`nautilus`等基础工具 - 建议提前备份重要数据 - 若需要保留部分应用,使用: ```bash sudo apt-mark manual 软件包名 # 例如:sudo apt-mark manual gnome-terminal ``` 3. **验证卸载结果**: ```bash ls /usr/share/xsessions/ # 应显示空目录或仅保留其他桌面环境 dpkg -l | grep -i gnome # 检查是否还有残余包 ``` --- ### **恢复方案** 若误删关键组件,可通过以下命令恢复基础CLI环境: ```bash sudo apt install --no-install-recommends debian-base ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值