- Files in Linux
There are two basic concepts in Linux - processes and files. The processes do things and files keep all the important data. An efficient filesystem is important for an operating system. When Unix was conceived around 1969-70, several design decisions were taken to simplify the filesystem. It was thought that if something was simple ...
- Connecting 7" touchscreen display to Raspberry Pi 4B
Raspberry Pi 4B has a Display Serial Interface (DSI) port for connecting a Raspberry Pi touchscreen display using a ribbon cable. In this post we will look at the process of connecting the Raspberry Pi 7" touchscreen display with the Raspberry Pi 4B single board computer.
2.0 7" touchscreen display
The Raspberry Pi 7" touchscreen ...
- Uname command with examples
1. uname command
The uname command prints information about the system. uname is a portmanteau word made up from "unix" and "name". uname can be called from the ...
- Getting started with Raspberry Pi
1.0 Raspberry Pi
Raspberry Pi is a popular single board computer developed by the Raspberry Pi Foundation in the U.K. Raspberry Pi 4 Model B (Pi4B) was released in June 2019. The ...
- systemd – System and service manager in Linux
systemd is the newer init system used in most Linux distributions since 2015. The first widely used init system was the System V init process, sysvinit. Ubuntu introduced the Upstart init system with Ubuntu 6.10 in 2006. Ubuntu fully migrated to systemd with Ubuntu 15.04 in 2015. Indeed, we ...
Syslog is a protocol for conveying event notification messages.
Syslog was first developed by Eric Allman for logging as a part of the Sendmail project in the 1980s. It soon became a de-facto standard for logging on Unix-like systems. Syslog was formally specified in RFC 3164 in 2001 as "The BSD syslog ...
- Find user login history – last and lastb commands in Linux
1.0 last and lastb
The last command gives a chronological list of user logins in a Linux system for a period of time. The lastb commands gives a similar list of failed logins ...
- tmpfs in Linux
tmpfs is a filesystem that resides in the main memory of a Linux system. In the case of disk files, a file is first fetched into the kernel pagecache and the delivered to the requesting process. The fetch ...
- Cut command in Linux
The cut command cuts sections of each line of input files and writes it on its standard output. It is mostly used for taking out a few columns from the ...
- tr Command in Linux
The tr command is a filter which reads the standard input, translates or deletes characters and writes on its standard output. The tr command syntax is,
tr transliterates characters from SET1 into corresponding characters of SET2 in input and writes ...
- Comm Command in Linux
The comm command compares two sorted files and gives output in three columns. The first column has lines which are present only in the first file. The second column contains lines which are present only in the second file. The third column gives the lines which are common to both files. ...
- Uniq command in Linux
The uniq command is a filter for finding unique lines in input. It reads input, suppresses duplicates and prints unique lines in its output. Used with the -D option, we can do the inverse and print the duplicate lines only. The input must be sorted ...
- Sort command in Linux
The sort command is for sorting lines in text files. For example, if we have a file names, we can sort it with the sort command,
$ cat names John Doe Jane Doe John Roe Richard Roe Tommy Atkins Max Mustermann Erika Mustermann Joe Bloggs $ $ sort names Erika Mustermann Jane Doe Joe Bloggs John Doe John Roe Max Mustermann Richard Roe Tommy Atkins
The words in ...
- Awk Tutorial
awk is a filter which takes the input and gives output after matching desired patterns and doing processing linked to matched patterns. awk is well suited for processing voluminous raw text data and producing statistical reports from it.
awk is named ...
- Sed command in Linux
sed is a stream editor that accepts a list of commands and input file names. It applies the commands one by one on each line of input and writes the resulting lines on the standard output. The commands are separated by newlines.
2.0 sed ...
- grep Command in Linux
grep is a program for searching a given string pattern in files. It searches the files for the pattern and prints the lines that contain strings matching the pattern. For example,
$ # grep pattern filenames ... $ grep 'hbox' find.c GtkWidget *window, ...
- Bash Scripting Tutorial
1.0 Bash Script
bash can be run interactively, as a login shell or as an interactive process from a terminal emulator like the gnome-terminal. bash can be run non-interactively by running a bash script. A bash script is a ...
- Bash Tutorial
A shell provides a user interface to a computer system. There are two types of shells, the command line interface (CLI) and the graphical user interface (GUI). In this tutorial, we describe the command line interface shell only and refer to it simply as
- Network Traffic Control with tc command in Linux
1.0 Network Traffic Control
For any host connected to a network, there is the possibility of network congestion. The network bandwidth is always limited. As the data flow on a network link increases, a time comes when the quality of service (QoS) gets degraded. Some of the data packets are ...
- ss command in Linux
1. ss command
The ss command gives the socket statistics. It gives information about the network connections. ss is a replacement for the netstat command.
By default, the ss command gives information about non-listening sockets.
$ ss Netid ...
- umask in Linux
In Linux, each files has nine permission bits. There are three basic permissions, read (r), write (w) and execute (x), for a file. These three permissions are there for the owner (o) of the file, the group (g) set for the file and the "others" (o). The ls -l command displays ...
- ip command in Linux
The iproute2 package contains utilities for network and traffic control. The major commands in iproute2 package are the ip command for IPV4 and IPV6 configuration and tc for traffic control. These commands replace the older
- htop command in Linux
htop is a ncurses based program for viewing processes in a system running Linux. htop is quite similar to the top command. However, since htop is a newer program compared to top, it ...
- Using vimdiff
vimdiff works on two, three or four files, opens each file in a separate window and highlights the differences between the files. The files can be edited using the vim commands. vimdiff is a useful tool for ...
- Git Tutorial
Git is a software source control system, originally developed by Linus Torvalds in 2005 for management of Linux kernel source code across versions. Using Git greatly simplifies the source code management functions for a project and improves the overall efficiency of the software development process. Git ...
- iptables command in Linux
The iptables command is for defining rules for packet filtering for establishing and configuring firewalls in Linux. iptables, also, helps in configuring the Network Address Translation (NAT) for placing a local area network behind a single public IP address for accessing the Internet and for other uses.
- Synchronizing Files Between Multiple Computers Using Unison
As we work on different computers at different times, it becomes increasingly difficult to keep track of file versions. For example, you might be working on a development of a new software product on a desktop computer. You might also have the development environment on a laptop and do some work on it occasionally. At ...
1. netstat command
The netstat command in Linux provides network statistics and information about the networking subsystem. It gives information about network connections, routing tables and network interface statistics. For example,
$ netstat Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Address ...
- Routing in Linux
In Internet, the Internet Protocol (IP) is at the Network Layer, which is the third layer of the ISO reference model of network architecture. IP deals with IP packets or datagrams, which are the basic transfer units in the Internet and the higher level protocols like UDP and TCP are built on top of IP ...
Linux daemons write log files. Left to itself, these log files would grow with time and take up the disk space. It is necessary to purge the log files periodically so that the disk space is conserved and is available for smooth running of the system. logrotate is a utility for rotation, ...
- sar in Linux
The sar command under Linux and Unix systems gives the system activity reports. As the system works, a record of activities is kept in certain counters in the kernel. The sar command gives statistics regarding the CPU, I/O, paging, devices, memory, swap space, network, run queue length and ...
The best way to use pidstat is to pass a list of process ids with the -p parameter. The -u option reports CPU utilization. The -l parameter displays the process command name and its arguments. And we can optionally put time interval in ...
The mpstat command in a Linux or Unix system gives the processor related statistics. mpstat is a part of the sysstat package for performance monitoring under Linux. The mpstat command gives the CPU utilization report ...
The iostat command is for getting the CPU and input-output devices' statistics for Linux and Unix systems. For example,
$ iostat Linux 3.0.0-14-generic (hostname) Wednesday 06 June 2012 _i686_ (2 CPU) avg-cpu: %user %nice %system %iowait %steal %idle ...
The vmstat command prints the system virtual memory statistics for Linux and Unix systems. vmstat prints information about system processes, memory, swap, I/O blocks, interrupts and context switches and the CPU activity. The most common command format is,
The optional delay parameter tells the time ...
- uptime and w commands in Linux
The uptime and w commands in Linux and Unix systems give pointed information about the system uptime, load average and about logged in users.
The uptime command is given as,
And the output is like,
07:47:08 up 25 ...
- Finding the free and used memory with the free command
Using the free command, the free and used memory in a Linux or Unix system can be found. The free command can be given from the command line as,
And the system responds with an output like,
- Load Average
Linux commands like top, uptime and w report the system load average. For instance, the first line of top command output is something like,
top - 04:56:31 up 60 days, 23:18, 1 user, load average: 0.02, ...
- top Command in Linux
The Unix top command is useful for monitoring systems continuously for processes that take more system resources like the CPU time and the memory. top periodically updates the display showing the high resource consuming processes at the top. top is an excellent aid in checking ...
- ps command usage examples in Linux
The ps command gives information about processes on a Linux or Unix system. Our programs run as processes in the system. Also, for each installed package, there might be one or more processes. So, to find out what is happening in the system, the first instinctive ...
- Synchronize your computer’s clock using the NTP
Coordinated Universal Time
The Coordinated Universal Time (UTC) is the universally accepted time standard based on atomic clocks with leap seconds added judiciously to keep it in tune with the traditional solar time. The UTC is available as standard from designated national measurement institutes (NMIs) in most countries. It is used as the standard by ...
- Alarm, sleep and High Resolution Timers
Alarm system call
The alarm system call arranges for the SIGALRM signal to be sent to the calling process after s seconds.
#include <unistd.h> unsigned int alarm (unsigned int s);
Any previously set alarm is cleared. And if s is 0, no alarm is set. So, passing 0 as argument to alarm clears any previously set alarm. ...
- Linux process execution time
A process has an execution time associated with it. The execution time comprises of two parts, the user time and the system time. The user time is the time spent by the CPU in executing instructions in user mode. The system time is the time spent by the CPU in executing instructions on ...
- Calendar Time Under Linux
1.0 The system calendar time since the Epoch, 1970-01-01 00:00:00, UTC
The Linux kernel maintains a system calendar time, which is initialized from the hardware real time clock (RTC) at the boot time and is incremented with the timer interrupt. The system calendar time is the number of seconds passed since January 1, 1970 00:00:00 ...
- hwclock, the hardware clock query and set program
The hardware clock
There are two clocks in a Linux system, the hardware real time clock (RTC) and the Linux system time maintained by the kernel. In this tutorial, we will look at the hardware real time clock.
The hardware real time clock is an integrated circuit, a part of computer's hardware, powered by a battery and ...
cron is a daemon that executes programs for users periodically at predefined times. The cron daemon or service is started by the init process during system initialization. cron comes from chronos, the Greek word for time. cron was authored by ...
- Backing up your Drupal site
Backing up a Drupal site involves copying the website files and database to a local server. We copy the entire site root directory tree to the local server. Also, we dump the website MySQL database at the site server and copy the database dump to the local server.
Let's start with the site's MySQL database. ...
- Moving a Drupal site to a new host
Moving a Drupal site to a new host is quite easy. It can be summarized as just two steps - backing up the MySQL database and the web-site root directory and storing these on the new host.
Backing up the website files at current host
Login as the administrator in your website at the current host. From ...
rsync is a one-way file synchronization tool used in Linux and other Unix-like systems. It is used to ensure that the destination file(s) become an exact replica of corresponding file(s) at the source, thus providing an excellent tool for taking backups. rsync is inherently a file copying tool. ...
- vi editor commands
vi is a classic text editor that has been available with Unix systems right from the beginning. vi has been a very popular text editor and one can edit files very efficiently using it. In this tutorial, we look at some of the vi commands that ...
- Using the make utility to build software (Advanced)
make is a utility for building programs based on the contents of a specially formatted text file named Makefile or makefile under Linux and Unix environments. A makefile has explicit rules, implicit rules, variable definitions, directives and comments. In the primer make tutorial, we looked at some example makefiles containing explicit ...
- Using the make utility to build software (Primer)
As the number of source files and libraries required to build a software increase in number, the build process gets more complicated and the time required to build the final executable becomes more and more. Here, the classic make utility available in Linux and other Unix-like environments comes to the rescue as it automatically builds ...
- Starting Linux services with init scripts
A Linux system provides many services to the users, like secure shell access or the print spooler service. These services need to be started and stopped at appropriate times. The start and stop of these services is controlled by
init scripts. An init script for a service specifies when that service should be started ...
- Understanding the GNU Build System
This tutorial looks at the GNU Build System. From an end-user's perspective, it first describes how to build the binary executable of a GNU free and open source software package from the available source code and install it on your system. Then, from a programmer's perspective it looks at the GNU Build System for generating ...
- Using diff and patch
Quite often, we wish to know the differences between two versions of a file or a group of files, which may be organized in a directory tree. We wish to be sure that work done is as desired and no errors have been introduced inadvertently in the file(s). We can only do that by reviewing ...
- Network Traffic Control with tc command in Linux