blurot.blogg.se

Linux and mac commands list
Linux and mac commands list











linux and mac commands list

The mv (move) utility can rename a file without making a copy of it. This command copied myfile from /root to /tmp/dir1 directory If the DESTINATION-FILE exists before you give a cp command, cp overwrites it. The DESTINATION-FILE is the name cp assigns to the resulting (new) copy of the file. The SOURCE-FILE is the name of the file that cp will copy. The cp (copy) utility makes a copy of a file. You can use the file utility to learn about the contents of any file on a Linux system without having to open and examine the file yourself.įile command identified the dataFile.txt type as ASCII text If a file contains a list of names and has two successive entries for the same person, uniq skips the extra line The uniq (unique) utility displays a file, skipping adjacent duplicate lines it does not change the original file. The –n option puts a list of numbers in numerical order. The –u option generates a sorted list in which each line is unique (no duplicates). The sort utility displays the contents of a file in order by lines To continuously monitor the incoming log messages into /var/log/messages file in runtime This example will display the last 5 lines of the provided fileīy default tail will show the last 10 lines of the file This example displays the top 5 lines of provided fileīy default the head utility displays the first ten lines of a file. You must use SPACE bar to scroll through the file We cannot use navigation arrow from the keyboard while reading with more

linux and mac commands list

More command is also similar to less but has few restrictions You can use keyboard arrow to navigate around the file to read the text It will pause after displaying a screen of text When you want to view a file that is longer than one screen, you can use either the less utility or the more utility. Print the content of the provided file on the terminal Long list files and sort by modification time. This is definitely not the complete list of Linux commands for file management but can give you a kickstart and can cover most of the basic to complex scenarios.

linux and mac commands list

The commands under this section are very basic commands and must be known to every system administrator. These variables comprise shell variables (variables not in the environment) and environment variables. When you run an export command with variable names as arguments, the shell places the names (and values, if present) of those variables in the environment. The env utility runs a program as a child of the current shell, allowing you to modify the environment the current shell exports to the newly created process. When called with the name of an environment variable, it displays the value of that variable. Displays environment variable names and values.













Linux and mac commands list