Found 1437 Articles for Linux

How to removes duplicate lines from a sorted file in Linux?

Shilpa S
Updated on 01-Jul-2021 15:34:36

7K+ Views

To remove duplicate lines from a sorted file and make it unique, we use the uniq command in the Linux system. The uniq command work as a kind of filter program that reports out the duplicate lines in a file. It filters adjacent matching lines from the input and gives a unique output. This command is also available in the Windows and IBM i operating system.SyntaxThe general syntax of the uniq command is as followsuniq [OPTION]... [INPUT [OUTPUT]]Brief description of options available in the fmt command.Sr.No.Option & Description1-c, --countDisplay how many times line was repeated.2-d—repeatedDisplay only repeated lines, one for ... Read More

How to remove sections from each line of files in the Linux system?

Shilpa S
Updated on 01-Jul-2021 15:32:04

2K+ Views

In this article, we will learn to remove sections from each line of files in the Linux/Unix operating system.To remove selected parts of lines from each FILE, we use the cut command in the Linux system.The cut command is used to remove and print the selected section of each FILE in the Linux operating system using a terminal. It is also used to cut the selected parts of a line by byte position, character, and field. It is also been ported to the IBM i operating system.SyntaxThe general syntax of the cut command is as followscut OPTION... [FILE]...Brief description of ... Read More

How to remove files and directories in the Linux operating system using the terminal?

Shilpa S
Updated on 01-Jul-2021 15:29:51

571 Views

The rm command is used to remove files and directories in the Linux operating system whereas the rmdir command is used to remove only empty directories.rm (remove) – rm stands for remove. It is used for files, directories, and symbolic links from the Linux system. By default, it does not remove directories. In the Windows operating system, the same working functionality is provided by the del (delete) command. The rm command is also available in EFI (Extensible Firmware Interface) shell.Note – Generally the rm command works silently so be careful while working with the rm command because after delete it is hard ... Read More

How to overwrite a file to hide file contents, and make original contents unrecoverable in Linux?

Shilpa S
Updated on 01-Jul-2021 15:18:12

4K+ Views

To overwrite and file contents in the Linux system, we use the shred command using the terminal.shred – The shred command is used to securely delete files and devices. This command overwrites a file to hide file contents, and optionally delete the file so that it is very difficult to recover the file for any software in the Linux/Unix system.As usual, to remove files from the system, we use the rm command using the terminal. After removal files through the rm command, it may be recoverable using the software whereas after removing files through the shred command files are unrecoverable ... Read More

How to move jobs to the background in the Linux system?

Shilpa S
Updated on 01-Jul-2021 14:50:52

2K+ Views

To move foreground jobs in the background, we use the bg command in the Linux system.bg (background) – The bg command is used to move foreground jobs in the background. It resumes execution of a suspended process in the background. If no job is specified, then the bg command work upon the currently running process.SyntaxThe general syntax of the bg command is as follows −bg [job_spec ...]Job Identifiers −Sr.No.Notation & Meaning1%nJob number2(n)%stringRefer to a job which was started by a command beginning with string3%? stringRefer to a job which was started by a command containing string4%% or %+Current job5%-Previous jobExit ... Read More

How to move a file, group of files, and directories in Linux?

Shilpa S
Updated on 01-Jul-2021 14:47:49

17K+ Views

The mv (move) command is used to move one or more files or directories from one directory to another directory using terminal in the Linux/Unix operating system. After using the mv command file is copied from source to destination and source file is removed. The mv command is also used to rename the file.SyntaxThe general syntax of the mv command is as follows$ mv [OPTION]...[-T] SOURCE DESTINATION... $ mv [OPTION]...SOURCE... DIRECTORY... $ mv [OPTION]...-t DIRECTORY SOURCE...Brief description of options available in the mv command.Sr.No.Option & Description1--backup [=CONTROL]Create backup of destination file2-bCreate backup file without argument3-fDo not prompt before overwriting4-i, interactivePrompt ... Read More

How to merge lines of files in the Linux system?

Shilpa S
Updated on 01-Jul-2021 14:39:22

7K+ Views

To merge lines of files, we use the paste command in the Linux system. The paste command is used to combine files horizontally by outputting lines consisting of the sequentially corresponding lines from each FILE, separated by TABs to the standard output. When it has completed its operating for the last file, paste will output newline character and move on to the next line.SyntaxThe general syntax of the paste command is as follows −paste [OPTION]... [FILE]...Note – with no FILE the paste command read input from standard input.Brief description of options available in the paste command.Sr.No.Option & Description1-d, --delimiters=LISTReuse characters from ... Read More

How to list the directory content in Linux?

Shilpa S
Updated on 01-Jul-2021 14:36:48

18K+ Views

In the Linux operating system, there are two commands available to list the directory contents.ls (list) commanddir (directory) commandListing the contents of the file using ls command.ls (list) – the ls command is used to list the directory contents in the Linux system. By default, the ls command displays the content of the current directory. The ls command is also available in EFI (Extensible Firmware Interface) shell.SyntaxThe general syntax of the ls command is as follow −$ ls [OPTION]... [FILE]...Brief description of option available in the ls command.Sr.No.Option & Description1-a, --allDisplay all files including hidden files2--authorDisplay author of each file ... Read More

How to join lines of two files on a common field in Linux?

Shilpa S
Updated on 01-Jul-2021 14:33:38

894 Views

To join lines of two files on a command field, we use the join command in the Linux system. The join command is used to join lines of two files on a common field in the Linux system. If we have two files and we want to join lines of files then no need to combine both files. We can join lines without combining files using the join command. By default, the join field is the first, delimited by blanks.SyntaxThe general syntax of the join command is as follows −join [OPTION]... FILE1 FILE2Note – If FILE1 or FILE2 or both ... Read More

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

Shilpa S
Updated on 01-Jul-2021 14:31:13

2K+ Views

Sometimes our text files are not well format to represent. This work can be done manually for small file, but if the file is too large then manually formatting is so tough work. In such a case to format the contents of a text file in the Linux operating system, we use the fmt command.The fmt command is used to format, simplifying, and optimizing text files in the Linux system. If the file is not specified then the fmt command reads input from standard input. By default, the fmt command creates text to a width of 75 characters wide.SyntaxThe general ... Read More

Advertisements