Operating System Articles - Page 153 of 199

How to add a new entry to the PATH variable in ZSH on Mac OS in Linux

Mukul Latiyan
Updated on 29-Jul-2021 11:06:32

14K+ Views

By default, we don’t have the .zshrc file present in macOS Catalina, and we need to create it. In order to create the .zshrc file, we can follow the steps shown below −Open TerminalType touch ~/.zshrc to create the file.Hit ReturnWe can also open the .zshrc file in the terminal from any directory by just typing the command shown belowExamplevi ~/.zshrcOutputimmukul@192 linux-questions-code % cat ~/.zshrc export GOPATH=/Users/immukul/go_projects export NDHOME=/Users/immukul/Downloads export GOTRACEBACK=all export GOROOT=/usr/local/go export LC_CTYPE=C export PATH=/home/Systems export LANG=CIt should be noted that the output may vary from machine to machine.To add an entry to the PATH variable present inside ... Read More

How to wrap each input line to fit in specified width in Linux?

Shilpa S
Updated on 01-Jul-2021 15:46:27

753 Views

To wraps a line in an input file to fit the specified width, we use the fold command in the Linux operating system.The fold command is used to making a file with long lines more readable on a limited width output by performing a line wrap in the Linux system. Most Linux/Unix terminals default screen width of 80, and sometimes while reading files with long lines could be annoying.The fold command wraps each input line to fit in specified width and allows the user to set the maximum length of a line. The fold command was inherited into the first ... Read More

How to split or break large files into pieces in Linux?

Shilpa S
Updated on 01-Jul-2021 15:43:19

12K+ Views

To split large files into small pieces, we use the split command in the Linux operating system.The split command is used to split or break large files into small pieces in the Linux system. By default, it generates output files of a fixed size, the default lines are 1000 and the default prefix would be ‘x’. For example, if the output file is not given, the default filename would be xaa, xab, etc. When a – (hyphen) is used instead of an input file then the data is derived from standard input.SyntaxThe general syntax of the split command as follows.split [OPTION]... ... Read More

How to sort lines of text files in Linux?

Shilpa S
Updated on 01-Jul-2021 15:41:01

14K+ Views

To sort lines of text files, we use the sort command in the Linux system.The sort command is used to prints the lines of its input or concatenation of all files listed in its argument list in sorted order. The operation of sorting is done based on one or more sort keys extracted from each line of input. By default, the entire input is taken as the sort key.SyntaxThe general syntax of the sort command is as follows.sort [OPTION]... [FILE]... sort [OPTION]... --files0-from=FBrief description of options available in the sort command.Sr.No.Option & Description1-b, --ignore-leading-blanksIgnore leading blanks.2-d, --dictionary-orderConsider only blanks and ... Read More

How to shrink or extend the size of a file in Linux?

Shilpa S
Updated on 01-Jul-2021 15:37:26

17K+ Views

The truncate command is used to shrink or extend the size of a file to the given size. The truncate command cannot remove the file whereas removes the contents of the file and set size of file is zero byte. The meaning of truncate is reducing. While reducing the size of the file is the specified size is less than actual size then extra data will be lost.SyntaxThe general syntax of the truncate command is as follows.$ truncate OPTION... FILE...Brief description of options available in the truncate command.Sr.No.Option & Description1-c, --no-createDo not create any files2-o, --io-blocksManage size as number of ... Read More

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 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

3K+ 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

18K+ 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

Advertisements