Linux Programming

You can use the cat command to see the content of a file and display the line numbers by using the -b option along with the cat command as follows

cat -b filename

You can use the wc command to get a count of the total number of lines, words, and characters contained in a file.

wc filename

To make a copy of a file use the cp command.

cp source_file destination_file

To go in your last directory

cd -

To list the files in a directory

ls dirname

An important Unix concept is the environment, which is defined by environment variables. Some are set by the system, others by you, yet others by the shell, or any program that loads another program.

A variable is a character string to which we assign a value. The value assigned could be a number, text, filename, device, or any other type of data. For example, first we set a variable TEST and then we access its value using the echo command

TEST="Unix Programming"
echo $TEST

  It produces the following result.

Unix Programming

  If we don‘t use the $ sign, it returns

TEST

  Really clear a terminal instead of simply shifting previous output upwards when you run "clear" command.

tput reset

  

原文地址:https://www.cnblogs.com/cxxszz/p/8573773.html

时间: 2024-08-05 04:44:07

Linux Programming的相关文章

QT开发--《Beginning Linux Programming》4th Edition

最近在学习<Beginning Linux Programming>4th Edition的时候,将下面的例子代码键入 #include<qapplication.h> #include<qmainwindow.h> int main(int argc,char* args[]) { QApplication app(argc,args); QMainWindow *window=new QMainWindow(); app.setMainWidget(window);

advanced linux programming note

1.pthread_create function creates thread that share the same memory with the process. 2.pthread_join function wait for threads until they stop 3.The pthread_self function returns the thread ID of the thread in which it iscalled;This thread ID may be

我的Linux书架

原文地址www.cnblogs.com/wwang/archive/2011/01/27/1944406.html 工作几年来,一直从事Linux内核驱动方面的开发.从接触Linux到现在,读过不少Linux方面的书籍,现把认为很不错的一部分列出来和大家分享一下. 入门类 一直认为,在一个系统上学习开发之前,首先需要熟悉这个系统的使用.鉴于天朝的国情,绝大部分人第一个接触的操作系统就是Windows,因此对于这绝大部分人来说,如果要学习Linux开发,学会使用这个系统都是必不可少的一个环节. 现

linux 操作系统下c语言编程入门

2)Linux程序设计入门--进程介绍 3)Linux程序设计入门--文件操作 4)Linux程序设计入门--时间概念 5)Linux程序设计入门--信号处理 6)Linux程序设计入门--消息管理 7)Linux程序设计入门--线程操作 8)Linux程序设计入门--网络编程 9)Linux下C开发工具介绍 1)Linux程序设计入门--基础知识 Linux下C语言编程基础知识 前言: 这篇文章介绍在LINUX下进行C语言编程所需要的基础知识.在这篇文章当中,我们将 会学到以下内容: 源程序编

一些linux嵌入式资源下载地址(转)

linux内核源代码情景分析 非扫描版 上下册合订版 字清楚 带书签 1575页 pdfhttp://download.csdn.net/source/2002579*************************************************************linux设备驱动开发详解 pdf,针对ARM9 s3c2410 经典 宋宝华 http://download.csdn.net/source/3135744随书光盘:http://download.csdn.n

linux的学习系列 5--环境变量

在Linux中,环境变量是一个很重要的概念.环境变量可以由系统.用户.Shell以及其他程序来设定. 变量就是一个可以被赋值的字符串,赋值范围包括数字.文本.文件名.设备以及其他类型的数据. 下面的例子,我们将为变量 TEST 赋值,然后使用 echo 命令输出: $TEST="Linux Programming" $echo $TEST Linux Programming 注意:变量赋值时前面不能加 $ 符号,变量输出时必须要加 $ 前缀.退出 Shell 时,变量将消失. 登录系统

推荐一些不错的计算机书籍(php c mysql linux等等)

推荐一些不错的计算机书籍. # PHP<PHP程序设计>(第2版)  --PHP语法和入门最好的书<PHP5权威编程>  --PHP入门后升级书<深入PHP:面向对象.模式与实践>(第3版) --理解PHP中的面向对象和设计模式<高性能PHP应用开发> --了解一些基本简单的PHP优化<PHP核心技术与最佳实践> --了解很多PHP高级技术和延伸技术<Extending and Embedding PHP>--PHP内核介绍和扩展开发

Linux/Unix 新手和专家教程

你正在找一些高质量的Linux 和 UNIX 的教程吗?如果是,这篇文章会告诉你到哪去找到这些教程.这里我们将给出超过30个相当的不错的 Linux 和 UNIX 在线的教程. 需要大家注意的是,他们都是英文的,也许有一些也经被翻译到了中文社区,你可以搜索一下.但不管怎么样,我的建议是应该尽可能的去阅读英文. Linux 和UNIX 的新手培训教程 免费的新手Linux教程 Introduction to Linux – 这是来自IBM的教程,用于给那些想学习Linux的人. Linux Des

Linux编译多个不同目录下的文件以及静态库、动态库的使用

先看两篇博文,作为基础知识.如果对C/C++编译链接过程都了解的话,可以跳过不看. http://www.firedragonpzy.com.cn/index.php/archives/2556 http://www.cppblog.com/shifan3/archive/2007/01/05/17325.html 一.  编译不同目录下的多个文件 各个文件的布局如下: head.h文件的代码: [cpp] view plaincopy #ifndef  HEAD_H #define  HEAD