Questions tagged «linux»

LINUX问题必须与编程有关。仅当您的问题与使用Linux API或Linux特定行为进行编程有关时才使用此标记,而不仅仅是因为您碰巧在Linux上运行代码。如果需要Linux支持,可以尝试https://unix.stackexchange.com或特定Linux发行版的Stack Exchange网站,例如https://askubuntu.com或https://elementaryos.stackexchange.com/

8
在printf中使用颜色
当这样写时,它以蓝色输出文本: printf "\e[1;34mThis is a blue text.\e[0m" 但我想在printf中定义格式: printf '%-6s' "This is text" 现在,我尝试了几种添加颜色的方法,但没有成功: printf '%-6s' "\e[1;34mThis is text\e[0m" 我什至尝试添加属性代码来格式化,但没有成功。这是行不通的,在任何地方都找不到将颜色添加到printf的示例,该示例已经定义了格式。
90 linux  bash  colors  printf 

13
在基于Linux的服务器上运行ASP.Net
这个问题的答案是社区的努力。编辑现有答案以改善此职位。它目前不接受新的答案或互动。 对于具有Java背景的开发人员,我也有兴趣探索使用ASP.NET工具/平台进行软件开发。 Java Web应用程序(.jsp和servlet)可以在许多服务器平台上运行。 问题:.NET Web应用程序能否在基于Linux的服务器上运行?考虑到无法使用Windows服务器托管Web应用程序的情况。
89 asp.net  linux  mono 

3
当“参数列表过长”时,如何删除所有3天以上的文件?
我有一个日志文件目录,其中包含82000个文件和目录(大约一半)。 我需要删除所有超过3天的文件和目录。 在其中包含37000个文件的目录中,我能够执行以下操作: find * -mtime +3 -exec rm {} \; 但是使用82000个文件/目录,我得到了错误: / usr / bin / find:参数列表太长 如何解决此错误,以便删除所有早于3天的文件/目录?

8
获取终端宽度在C?
我一直在寻找一种从C程序中获取终端宽度的方法。我不断提出的思路是: #include <sys/ioctl.h> #include <stdio.h> int main (void) { struct ttysize ts; ioctl(0, TIOCGSIZE, &ts); printf ("lines %d\n", ts.ts_lines); printf ("columns %d\n", ts.ts_cols); } 但是每次我尝试得到 austin@:~$ gcc test.c -o test test.c: In function ‘main’: test.c:6: error: storage size of ‘ts’ isn’t known test.c:7: error: ‘TIOCGSIZE’ undeclared (first use in this …
89 c  linux  terminal  width 

8
Linux进程状态
在Linux中,当需要从磁盘读取块时,进程状态会发生什么变化?被封锁了吗?如果是这样,如何选择另一个流程来执行?
89 linux  process  kernel  cpu  states 

4
用G ++编译多线程代码
我有史以来最简单的代码: #include <iostream> #include <thread> void worker() { std::cout << "another thread"; } int main() { std::thread t(worker); std::cout << "main thread" << std::endl; t.join(); return 0; } 尽管我仍然无法编译g++运行它。 更多细节: $ g++ --version g++ (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the …
89 c++  linux  ubuntu  gcc  g++ 


2
什么是vdso和vsyscall?
我做了 sudo cat /proc/1/maps -vv 我试图弄清楚输出,可以看到很多共享库都按预期映射到了内存映射段。 7f3c00137000-7f3c00179000 r-xp 00000000 08:01 21233923 /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8 7f3c00179000-7f3c00379000 ---p 00042000 08:01 21233923 /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8 7f3c00379000-7f3c0037a000 r--p 00042000 08:01 21233923 /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8 7f3c0037a000-7f3c0037b000 rw-p 00043000 08:01 21233923 /lib/x86_64-linux-gnu/libdbus-1.so.3.5.8 7f3c0037b000-7f3c00383000 r-xp 00000000 08:01 21237216 /lib/x86_64-linux-gnu/libnih-dbus.so.1.0.0 7f3c00383000-7f3c00583000 ---p 00008000 08:01 21237216 /lib/x86_64-linux-gnu/libnih-dbus.so.1.0.0 7f3c00583000-7f3c00584000 r--p 00008000 08:01 21237216 /lib/x86_64-linux-gnu/libnih-dbus.so.1.0.0 7f3c00584000-7f3c00585000 rw-p …
89 c  linux  linux-kernel  kernel  vdso 

16
tar:将所有文件和目录添加到当前目录中,包括.svn等
我尝试在tar.gz目录中使用 tar -czf workspace.tar.gz * 生成的tar包含.svn子目录中的目录,但不包含当前目录中的目录(因为*在传递给tar之前已扩展为仅“可见”文件 我尝试过了 tar -czf workspace.tar.gz .相反,但是然后我得到一个错误,因为“。” 阅读时发生了变化: tar: ./workspace.tar.gz: file changed as we read it 有没有技巧可以*匹配目录中的所有文件(包括点缀)? (在Linux SLES-11(2.6.27.19)上使用bash

3
cp -r没有隐藏文件
我有两个目录,一个是空的。 第一个目录有许多带有隐藏文件的子目录。当我cp -r从第一个目录满意到第二个目录时,隐藏文件也被复制。有什么办法可以逃脱它们吗?
89 linux  bash  cp 

11
寻找独特的线条
如何找到唯一的行并从文件中删除所有重复项?我的输入文件是 1 1 2 3 5 5 7 7 我希望结果是: 2 3 sort file | uniq不会做这份工作。将显示所有值1次
89 linux  sorting  unique  uniq 

8
如何在Python的matplotlib中设置“后端”?
我是matplotlib的新用户,我的平台是Ubuntu 10.04 Python 2.6.5 这是我的代码 import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt plt.plot([1,2,3]) 错误是: /usr/local/lib/python2.6/dist-packages/matplotlib/backends/__init__.py:41: UserWarning: Your currently selected backend, 'agg' does not support show(). Please select a GUI backend in your matplotlibrc file ('/usr/local/lib/python2.6/dist-packages/matplotlib/mpl-data/matplotlibrc') or with matplotlib.use() (backend, matplotlib.matplotlib_fname())) 我安装了“防颗粒几何”库,apt-get install libagg但是它不起作用。 我试图使用后端的其他参数,例如“ GTK”和“ TkAgg”。 我安装了python-gtk2-dev软件包,但错误仍在下面。 谁能告诉我一个可执行的后端参数及其依赖库? 这是错误: >>> …

5
如何在切片的“屏幕”终端中上下滚动
我刚安装screen并且喜欢将linux终端分成多个部分的想法。但是我无法弄清楚一件事:当我进入时如何上下滚动screen。当我使用常规的Linux终端时,可以通过Shift+Pg Up或Shift+ Pg Dn`实现。但不幸的是,它不适用于分割终端。 这就是我说screen和分割终端时的意思: 这是一个常规的终端(以防万一):

14
找不到宝石指令
我已经在Ubuntu 10.10 32位上安装了gem apt-get install gem -y 但是当我尝试跑步时 gem install something.gem 我收到找不到命令的错误。 bash: gem: command not found 我安装了gem,是否有任何理由说找不到命令? 这些文件是通过gem软件包安装的 http://pastie.org/3483416
89 ruby  linux  rubygems 


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.