Difference between revisions of "GNULinux tips"
Gurumurthy (talk | contribs) (Created page with "command: top purpose: display Linux tasks.It can display system summary information as well as a list of tasks currently being managed by the ...") |
KOER admin (talk | contribs) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | ==Offline installation of packages== | |
− | purpose: display Linux tasks.It can display system summary information | + | |
− | + | When one installs any package to Ubuntu, the *.deb files downloaded will be saved in <code>/var/cache/apt/archives</code> directory. So if the same packages needs to be installed on other machines with same Ubuntu distribution version, the downloaded *.deb files can be used. Please follow below procedure to do that: | |
− | + | ||
+ | # Copy the files from <code>/var/cache/apt/archives</code> directory to any external drive. | ||
+ | # Copy these files from external drive to the Desktop. | ||
+ | # Use below commands to copy files from Desktop to <code>/var/cache/apt/archives</code> directory: | ||
+ | sudo -s | ||
+ | cp ~/Desktop/*.deb /var/cache/apt/archives | ||
+ | sudo apt-get install <code>package_name</code> | ||
+ | |||
+ | Note: Unless you have updated repos on the target machine, you may have to run <code>sudo apt-get update</code> which will require Internet. | ||
+ | |||
+ | |||
+ | |||
+ | ==List of Commands== | ||
+ | ===Top=== | ||
+ | purpose: display Linux tasks.It can display system summary information as well as a list of tasks currently being managed by the Linux kernel | ||
syntax: top -hv | -bcHisS -d -n -p | syntax: top -hv | -bcHisS -d -n -p | ||
Line 21: | Line 35: | ||
examples: | examples: | ||
− | |||
1. $top | 1. $top | ||
display information like tasks, memory, cpu, and swap press q to quit | display information like tasks, memory, cpu, and swap press q to quit | ||
Line 37: | Line 50: | ||
7. to save top command results | 7. to save top command results | ||
$top shift+w | $top shift+w | ||
+ | |||
+ | |||
+ | ===Free=== | ||
+ | |||
+ | purpose: Display amount of free and used memory in the system. Displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the | ||
+ | kernel. | ||
+ | |||
+ | Syntax: free [-b|-k|-m|-g] [-c count] [-l] [-o] [-t] [-s delay] [-V] | ||
+ | |||
+ | |||
+ | Options: | ||
+ | -b Display the amount of memory in bytes. | ||
+ | |||
+ | -c count | ||
+ | Display the result count times. Requires the -s option. | ||
+ | |||
+ | -g Display the amount of memory in gigabytes. | ||
+ | |||
+ | -k Display the amount of memory in kilobytes. This is the default. | ||
+ | |||
+ | -l Show detailed low and high memory statistics. | ||
+ | |||
+ | -m Display the amount of memory in megabytes. | ||
+ | |||
+ | -o Display the output in old format, the only difference being this option will disable the display of the "buffer adjusted" line. | ||
+ | |||
+ | -s Continuously display the result delay seconds apart. | ||
+ | |||
+ | -t Display a line showing the column totals. | ||
+ | |||
+ | -V Display version information. | ||
+ | |||
+ | example: | ||
+ | |||
+ | 1. by default free command shows the free and used space of physical and swap memory in kb | ||
+ | #free | ||
+ | 2. switch the free output in bytes/kb/mb/gb | ||
+ | #free -b | ||
+ | #free -k | ||
+ | #free -m | ||
+ | #free -g | ||
+ | 3. To display the totals line at the end, execute free command with -t option | ||
+ | #free -t | ||
+ | 4. Free command displays the output with buffer line normally. we can disable that line in the display by using -o option | ||
+ | #free -o | ||
+ | 5. With -s optoin, we can activate the display of free to show it in every regular intervals for 5 seconds | ||
+ | #free -s 5 |
Latest revision as of 11:28, 25 January 2016
Offline installation of packages
When one installs any package to Ubuntu, the *.deb files downloaded will be saved in /var/cache/apt/archives
directory. So if the same packages needs to be installed on other machines with same Ubuntu distribution version, the downloaded *.deb files can be used. Please follow below procedure to do that:
- Copy the files from
/var/cache/apt/archives
directory to any external drive. - Copy these files from external drive to the Desktop.
- Use below commands to copy files from Desktop to
/var/cache/apt/archives
directory:
sudo -s
cp ~/Desktop/*.deb /var/cache/apt/archives
sudo apt-get install package_name
Note: Unless you have updated repos on the target machine, you may have to run sudo apt-get update
which will require Internet.
List of Commands
Top
purpose: display Linux tasks.It can display system summary information as well as a list of tasks currently being managed by the Linux kernel
syntax: top -hv | -bcHisS -d -n -p
-b batchmode -c command line/program name -d delay time interval -h help -H threads toggle -i idle processes -n number of iterations -u monitor by user -U monitor by user with UID -p monitor PID -s secure mode operation -S cumulative time mode -v version
examples: 1. $top
display information like tasks, memory, cpu, and swap press q to quit
2. to display specific user process
$top -u username
3. when top is running Press (Shift+O) to Sort field via field letter, for
example press ‘a‘ letter to sort process with PID (Process ID)
4. Press ‘z‘ option in running top command will display running process
in color which may help you to identified running process easily
5. Top output keep refreshing until we press ‘q‘. With below command top
command will automatically exit after 10 number of repetition. $top -n 10
6. top -h to obtain top command help
$top -h
7. to save top command results
$top shift+w
Free
purpose: Display amount of free and used memory in the system. Displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel.
Syntax: free [-b|-k|-m|-g] [-c count] [-l] [-o] [-t] [-s delay] [-V]
Options:
-b Display the amount of memory in bytes.
-c count Display the result count times. Requires the -s option.
-g Display the amount of memory in gigabytes.
-k Display the amount of memory in kilobytes. This is the default.
-l Show detailed low and high memory statistics.
-m Display the amount of memory in megabytes.
-o Display the output in old format, the only difference being this option will disable the display of the "buffer adjusted" line.
-s Continuously display the result delay seconds apart.
-t Display a line showing the column totals.
-V Display version information.
example:
1. by default free command shows the free and used space of physical and swap memory in kb
#free
2. switch the free output in bytes/kb/mb/gb
#free -b #free -k #free -m #free -g
3. To display the totals line at the end, execute free command with -t option
#free -t
4. Free command displays the output with buffer line normally. we can disable that line in the display by using -o option
#free -o
5. With -s optoin, we can activate the display of free to show it in every regular intervals for 5 seconds
#free -s 5