Operating System Articles

Page 80 of 171

How to compare two sorted files line by line in the Linux system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 2K+ Views

To compare two sorted files line by line in Linux, we use the comm command. The comm command compares two sorted files and displays the differences and similarities in a structured three-column format. The comm command writes output to three tab-separated columns: the first column contains lines unique to the first file, the second column contains lines unique to the second file, and the third column contains lines common to both files. Both input files must be sorted for comm to work correctly. Syntax The general syntax of the comm command is − comm [OPTION]... ...

Read More

How to converts tabs to spaces in the Linux system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 4K+ Views

While working with files, sometimes we encounter situations where a file contains many tabs and the requirement is to have spaces instead. For simple files, this conversion is easy, but for large files with numerous tabs, manual conversion becomes very difficult. This is where the expand command becomes essential. The expand command in Linux is used to convert tabs to spaces. If no file is specified, the expand command reads from standard input and processes the text accordingly. Syntax The general syntax of the expand command is as follows − expand [OPTION]... [FILE]... ...

Read More

How to copy a file, group of files, or directory in Linux?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 2K+ Views

The cp command is used to copy files or directories in Linux/Unix systems. It allows you to duplicate files from a source location to a destination directory. By default, cp works with files only − to copy directories, you must use the -R (recursive) option. Syntax The general syntax of the cp command is as follows − cp [OPTION]... [-T] SOURCE DESTINATION cp [OPTION]... SOURCE... DIRECTORY cp [OPTION]... -t DIRECTORY SOURCE... Common Options Option Description -R, -r, --recursive Copy directories recursively -i, --interactive Prompt ...

Read More

How to create a new directory in Linux using the terminal?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 3K+ Views

The mkdir command is used to create a new directory in the Linux/Unix operating system. It can create single or multiple directories at once and set permissions during creation, similar to the chmod command. Syntax The general syntax of the mkdir command is as follows − $ mkdir [OPTION]... [DIRECTORIES]... Command Options Option Description -m, --mode=MODE Set file permissions at the time of directory creation (like chmod) -p, --parents Create parent directories as needed; no error if directory exists -v, --verbose Display ...

Read More

How to create key binds in the Linux system using the terminal?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 2K+ Views

To set Readline key bindings and variables in the Linux system, we use the bind command. The bind command is used to assign functions and macros to keys, allowing you to create hotkeys instead of typing entire commands. It is a shell built-in command available in bash. Syntax The syntax of the bind command is as follows − bind [-lpsvPSVX] [-m KEYMAP] [-f FILENAME] [-q NAME] [-u NAME] [-r KEYSEQ] [-x KEYSEQ:shell-command] While the general syntax appears complex, the bind command is simple to use and allows you to easily create custom key bindings ...

Read More

How to list all users who are currently logged into the Linux system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 4K+ Views

The who command is a fundamental Linux utility used to display information about users who are currently logged into the system. It shows details such as login names, terminal lines, login times, and remote hostnames. The who command is closely related to the w command, which displays additional information about user processes. Syntax The general syntax of the who command is − who [OPTION]... [ FILE | ARGUMENT1 ARGUMENT2 ] Common Options Option Description -a, --all Same as -b -d --login -p -r -t -T -u ...

Read More

How to display the first part of the file in the Linux system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 13K+ Views

The head command in Linux is used to display the first part of a file or piped data. By default, it shows the first 10 lines of the specified file, making it useful for quickly previewing file contents without opening the entire file. Syntax The general syntax of the head command is − head [OPTION]... [FILE]... Common Options Option Description -n NUM Display the first NUM lines instead of the default 10 -c NUM Display the first NUM bytes of each file ...

Read More

How to display the last part of the file in the Linux system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 21K+ Views

To display the last part of a file, we use the tail command in the Linux system. The tail command is used to display the end of a text file or piped data in the Linux operating system. By default, it displays the last 10 lines of its input to the standard output. It is the complement of the head command. Syntax The general syntax of the tail command is as follows − tail [OPTION]... [FILE]... Options Brief description of options available in the tail command: Option Description ...

Read More

How to flushes file system buffers in the Linux operating system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 2K+ Views

To synchronize cached writes to persistent storage, we use the sync command in the Linux operating system. This command ensures that data stored in memory buffers is written to disk, preventing data loss during unexpected shutdowns or system crashes. The sync command synchronizes file data between volatile memory (RAM) and persistent storage devices like hard drives or SSDs. When applications write data, it is initially stored in kernel buffers for performance reasons. The sync command forces these buffers to be written to disk immediately. How File System Buffers Work Linux uses a write-back caching strategy where data ...

Read More

How to format contents of a text file in the Linux system?

Shilpa S
Shilpa S
Updated on 17-Mar-2026 3K+ Views

Sometimes text files are not well formatted for presentation. While manual formatting works for small files, it becomes impractical for large files. In Linux, we use the fmt command to format the contents of text files efficiently. The fmt command is used to format, simplify, and optimize text files in the Linux system. If no file is specified, fmt reads input from standard input. By default, it creates text lines that are 75 characters wide. Syntax The general syntax of the fmt command is as follows − fmt [-WIDTH] [OPTION]... [FILE]... Options ...

Read More
Showing 791–800 of 1,707 articles
« Prev 1 78 79 80 81 82 171 Next »
Advertisements