# Administração Linux

Administração Servidores Linux

# Controlar Fans/Coolers - Linux

Controla os fans/coolers/temperatura com ipmitool

# How to control Dell server fanspeeds with ipmitool

Link: [https://wiki.joeplaa.com/en/tutorials/how-to-control-dell-server-fanspeeds-with-ipmitool](https://wiki.joeplaa.com/en/tutorials/how-to-control-dell-server-fanspeeds-with-ipmitool)

# Introduction

I'm running a homelab partly as a hobby, but also to support our business needs, especially the software development part. My current setup consist of three servers, one HP and two Dell servers. The HP server is running perfectly fine when considering its temperatures and fanspees. The fans are throttled down pretty aggressively, so I don't really have too much of an issue with noise. It will speed up and make a racket when TeamCity is doing its thing, but that is shortlived.

The Dells however are troublesome. I have a T320 with 8 harddisks running TrueNAS. The disks obviously produce heat and the single fan in the tower doesn't generate enough airflow. Or better said, because the air shroud is missing, the air is not properly routed along the disk and through the CPU heat sink. The CPU will run into the 50°C region (when idling) when the ambient temperature is around 30°C (we're experiencing a heat wave).

The other Dell, a R320, is just loud. The little fans have to spin at an insane rate to keep the CPU cool. On top of that, I flashed the RAID card to passthrough mode for ZFS. The server doesn't get any disk temperature readings and thus preventatively speeds up the fans (this doesn't seem to apply to the T320).

The real solution would be to have a dedicated, air-conditioned (or at least well ventilated) room. But alas, we don't have that luxury. Currently the servers are in a little hallway next to the office. This little room will heat up quickly with three servers buzzing away, so the doors cannot be closed permanently.

A temporary "fix", well it isn't really a fix, because they are still very loud, is to slow down the fans manually using `ipmitool` commands. The downside obviously is that temperatures will go up quickly. Luckily [brezlord](https://github.com/brezlord/iDRAC7_fan_control) made [a script](https://github.com/brezlord/iDRAC7_fan_control) to fix that, thanks man!.

# The script

I modified it a little to fit my specific usecase:

- Changed the "dynamic" temperature from 35 to 45°C
- Added additional speed settings
- Use the CPU instead of inlet (ambient) temperature to control the speeds
- Added additional speed increments

```bash
#!/bin/bash
#
# https://github.com/brezlord/iDRAC7_fan_control
# A simple script to control fan speeds on Dell generation 12 PowerEdge servers.
# If the inlet temperature is above 45deg C enable iDRAC dynamic control and exit program.
# If inlet temp is below 45deg C set fan control to manual and set fan speed to predetermined value.
# The tower servers T320, T420 & T620 inlet temperature sensor is after the HDDs so temperature will
# be higher than the ambient temperature.

# Variables
IDRAC_IP="IP address of iDRAC"
IDRAC_USER="user"
IDRAC_PASSWORD="password"
# Fan speed in %
SPEED0="0x00"
SPEED5="0x05"
SPEED10="0x0a"
SPEED15="0x0f"
SPEED20="0x14"
SPEED25="0x19"
SPEED30="0x1e"
SPEED35="0x23"
SPEED40="0x28"
SPEED45="0x2D"
SPEED50="0x32"
TEMP_THRESHOLD="45" # iDRAC dynamic control enable threshold
#TEMP_SENSOR="04h"   # Inlet Temp
#TEMP_SENSOR="01h"  # Exhaust Temp
TEMP_SENSOR="0Eh"  # CPU 1 Temp
#TEMP_SENSOR="0Fh"  # CPU 2 Temp

# Get system date & time.
DATE=$(date +%d-%m-%Y\ %H:%M:%S)
echo "Date $DATE"

# Get temperature from iDARC.
T=$(ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD sdr type temperature | grep $TEMP_SENSOR | cut -d"|" -f5 | cut -d" " -f2)
echo "--> iDRAC IP Address: $IDRAC_IP"
echo "--> Current CPU Temp: $T"

# If CPU ~~ambient~~ temperature is above 45deg C enable dynamic control and exit, if below set manual control.
if [[ $T > $TEMP_THRESHOLD ]]
then
  echo "--> Temperature is above 45deg C"
  echo "--> Enabled dynamic fan control"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x01 0x01
  exit 1
else
  echo "--> Temperature is below 45deg C"
  echo "--> Disabled dynamic fan control"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x01 0x00
fi

# Set fan speed dependant on CPU ~~ambient~~ temperature if CPU ~~inlet~~ temperature is below 45deg C.
# If CPU ~~inlet~~ temperature between 0 and 19deg C then set fans to 15%.
if [ "$T" -ge 0 ] && [ "$T" -le 19 ]
then
  echo "--> Setting fan speed to 15%"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED15

# If inlet temperature between 20 and 24deg C then set fans to 20%
elif [ "$T" -ge 20 ] && [ "$T" -le 24 ]
then
  echo "--> Setting fan speed to 20%"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED20

# If inlet temperature between 25 and 29deg C then set fans to 25%
elif [ "$T" -ge 25 ] && [ "$T" -le 29 ]
then
  echo "--> Setting fan speed to 25%"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED25

# If inlet temperature between 30 and 34deg C then set fans to 30%
elif [ "$T" -ge 30 ] && [ "$T" -le 34 ]
then
  echo "--> Setting fan speed to 30%"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED30

# If inlet temperature between 35 and 40deg C then set fans to 35%
elif [ "$T" -ge 35 ] && [ "$T" -le 39 ]
then
  echo "--> Setting fan speed to 35%"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED35

# If inlet temperature between 40 and 45deg C then set fans to 40%
elif [ "$T" -ge 40 ] && [ "$T" -le 45 ]
then
  echo "--> Setting fan speed to 40%"
  ipmitool -I lanplus -H $IDRAC_IP -U $IDRAC_USER -P $IDRAC_PASSWORD raw 0x30 0x30 0x02 0xff $SPEED40
fi
```

<div class="code-toolbar" id="bkmrk-copy" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div># Implementation

## pfSense

1. Create a folder `/root/fan_control`
2. The Bash executable in pfSense is located in `usr/local/bin/bash`, so make sure this is specified in the top of the script:
    
    ```bash
    #!/usr/local/bin/bash
    ...
    ```
3. Copy the script to the folder
4. Make script executable: `chmod +x /root/fan_control/fan_control.sh`
5. Add iDRAC credentials in script
6. Run the script to test
7. Create a cron job with `crontab -e` and add line:
    
    ```shell
    * * * * * /usr/local/bin/bash /root/fan_control/fan_control.sh >/dev/null 2>&1
    ```

## TrueNAS

I followed [breznet's guide](https://www.breznet.com/dell-idrac7-manual-fan-control/).

1. Create a dataset `fan_control`
2. Copy the script to the dataset
3. Make script executable: `chmod +x /mnt/store1/fan_control/fan_control.sh`
4. Add iDRAC credentials in script
5. Run the script to test
6. Create a cron job in TrueNAS GUI running every minute

![cronjob-truenas-fan_control.png](https://wiki.joeplaa.com/images/cronjob-truenas-fan_control.png)

#   

# Script controla fan - decimal/hexadecinal

Link: [https://forum.proxmox.com/threads/ipmi-tool-error-after-v8-upgrade.129334/page-2](https://forum.proxmox.com/threads/ipmi-tool-error-after-v8-upgrade.129334/page-2)

<div class="bbCodeBlock-title" id="bkmrk-bash%3A">Bash:</div>```bash
#!/bin/bash

# Fancontrol v1.1 2022-09-15 15:42

# Define variables

MAX_FAN=90
MIN_FAN=20
HIGH_TEMP=37
LOW_TEMP=35
SPEED_STEP=10
IDRAC_IP=10.0.0.1
IPMI_USER=fancontrol
IPMI_PASSWORD=yoursupercomplexpassword

# Define Functions

ENABLE_FAN ()
{
 ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x01 0x00 > /dev/null 2>&1
}


GET_TEMP ()
{
 ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD  sensor reading "Exhaust Temp"|sed 's/[^0-9]//g'
}


SET_FAN ()
{
 ipmitool -I lanplus -H $IDRAC_IP -U $IPMI_USER -P $IPMI_PASSWORD raw 0x30 0x30 0x02 0xff $FAN_SETTING > /dev/null 2>&1
}

# File to save the last fan speed

 [ -f fan_speed.last ] || echo $MIN_FAN > fan_speed.last

FAN_SPEED=$(<fan_speed.last)

#-----------------------------------------------------------------------------------------

CURRENT_TEMP=$(GET_TEMP)                # get the current temperature

 if (($CURRENT_TEMP > $HIGH_TEMP)) ; then
    FAN_SPEED=$(expr $FAN_SPEED + $SPEED_STEP)
     if (($FAN_SPEED > $MAX_FAN)) ; then
                FAN_SPEED=$MAX_FAN
        fi
 fi

 if (($CURRENT_TEMP < $LOW_TEMP)) ; then
     FAN_SPEED=$(expr $FAN_SPEED - $SPEED_STEP)
     if (($FAN_SPEED < $MIN_FAN)) ; then
         FAN_SPEED=$MIN_FAN
     fi
 fi

FAN_SETTING=$(printf "0x"'%x\n' $FAN_SPEED)
ENABLE_FAN
SET_FAN

logger -t FanControl "Current Temperature" $CURRENT_TEMP"C" "Fans at" $FAN_SPEED"%"
echo $FAN_SPEED > fan_speed.last

exit 0
```

**Informações adicionais:**

Launch a command prompt on the server and navigate to the directory above. Then run the following commands, substituting the ip address (-H), username (-U), and password (-P) of your iDRAC:

```
To enable remote fan control: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x01 0x00

To set the fan to 20%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x14

To set the fan to 25%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x19

To set the fan to 30%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x1e

To set the fan to 35%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x23

To set the fan to 40%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x28

To set the fan to 45%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x2D

To set the fan to 50%: ipmitool -I lanplus -H 192.168.1.240 -U root -P calvin raw 0x30 0x30 0x02 0xff 0x32
```

**TABELA CONVERSÃO DECIMAL PARA HEXADECIMAL**

# Decimal-hexadecimal-binary conversion table

<div class="table-responsive" id="bkmrk-dec-hex-bin-%C2%A0-dec-he"><table class="cellpadding-1 table" style="width: 102.975%;" title="This table contains four sets of three columns, each of which give the decimal, hexadecimal, and binary values for the same quantity. The first, fourth, seventh, and tenth columns list a decimal value. The second, fifth, eighth, and eleventh columns list a matching hexadecimal value for the decimal values. The third, sixth, ninth, and twelfth columns list a matching binary value for the decimal values."><colgroup><col style="width: 6.19585%;"></col><col style="width: 6.31501%;"></col><col style="width: 10.7236%;"></col><col style="width: 3.45538%;"></col><col style="width: 6.67246%;"></col><col style="width: 6.67246%;"></col><col style="width: 10.6044%;"></col><col style="width: 1.19151%;"></col><col style="width: 6.0767%;"></col><col style="width: 6.31501%;"></col><col style="width: 10.9619%;"></col><col style="width: 1.31066%;"></col><col style="width: 6.31501%;"></col><col style="width: 6.07867%;"></col><col style="width: 11.1982%;"></col></colgroup><tbody><tr><td>Dec</td><td>Hex</td><td>Bin</td><td> </td><td>Dec</td><td>Hex</td><td>Bin</td><td> </td><td>Dec</td><td>Hex</td><td>Bin</td><td> </td><td>Dec</td><td>Hex</td><td>Bin</td></tr><tr><td>0</td><td>0</td><td>00000000</td><td> </td><td>64</td><td>40</td><td>01000000</td><td> </td><td>128</td><td>80</td><td>10000000</td><td> </td><td>192</td><td>c0</td><td>11000000</td></tr><tr><td>1</td><td>1</td><td>00000001</td><td> </td><td>65</td><td>41</td><td>01000001</td><td> </td><td>129</td><td>81</td><td>10000001</td><td> </td><td>193</td><td>c1</td><td>11000001</td></tr><tr><td>2</td><td>2</td><td>00000010</td><td> </td><td>66</td><td>42</td><td>01000010</td><td> </td><td>130</td><td>82</td><td>10000010</td><td> </td><td>194</td><td>c2</td><td>11000010</td></tr><tr><td>3</td><td>3</td><td>00000011</td><td> </td><td>67</td><td>43</td><td>01000011</td><td> </td><td>131</td><td>83</td><td>10000011</td><td> </td><td>195</td><td>c3</td><td>11000011</td></tr><tr><td>4</td><td>4</td><td>00000100</td><td> </td><td>68</td><td>44</td><td>01000100</td><td> </td><td>132</td><td>84</td><td>10000100</td><td> </td><td>196</td><td>c4</td><td>11000100</td></tr><tr><td>5</td><td>5</td><td>00000101</td><td> </td><td>69</td><td>45</td><td>01000101</td><td> </td><td>133</td><td>85</td><td>10000101</td><td> </td><td>197</td><td>c5</td><td>11000101</td></tr><tr><td>6</td><td>6</td><td>00000110</td><td> </td><td>70</td><td>46</td><td>01000110</td><td> </td><td>134</td><td>86</td><td>10000110</td><td> </td><td>198</td><td>c6</td><td>11000110</td></tr><tr><td>7</td><td>7</td><td>00000111</td><td> </td><td>71</td><td>47</td><td>01000111</td><td> </td><td>135</td><td>87</td><td>10000111</td><td> </td><td>199</td><td>c7</td><td>11000111</td></tr><tr><td>8</td><td>8</td><td>00001000</td><td> </td><td>72</td><td>48</td><td>01001000</td><td> </td><td>136</td><td>88</td><td>10001000</td><td> </td><td>200</td><td>c8</td><td>11001000</td></tr><tr><td>9</td><td>9</td><td>00001001</td><td> </td><td>73</td><td>49</td><td>01001001</td><td> </td><td>137</td><td>89</td><td>10001001</td><td> </td><td>201</td><td>c9</td><td>11001001</td></tr><tr><td>10</td><td>a</td><td>00001010</td><td> </td><td>74</td><td>4a</td><td>01001010</td><td> </td><td>138</td><td>8a</td><td>10001010</td><td> </td><td>202</td><td>ca</td><td>11001010</td></tr><tr><td>11</td><td>b</td><td>00001011</td><td> </td><td>75</td><td>4b</td><td>01001011</td><td> </td><td>139</td><td>8b</td><td>10001011</td><td> </td><td>203</td><td>cb</td><td>11001011</td></tr><tr><td>12</td><td>c</td><td>00001100</td><td> </td><td>76</td><td>4c</td><td>01001100</td><td> </td><td>140</td><td>8c</td><td>10001100</td><td> </td><td>204</td><td>cc</td><td>11001100</td></tr><tr><td>13</td><td>d</td><td>00001101</td><td> </td><td>77</td><td>4d</td><td>01001101</td><td> </td><td>141</td><td>8d</td><td>10001101</td><td> </td><td>205</td><td>cd</td><td>11001101</td></tr><tr><td>14</td><td>e</td><td>00001110</td><td> </td><td>78</td><td>4e</td><td>01001110</td><td> </td><td>142</td><td>8e</td><td>10001110</td><td> </td><td>206</td><td>ce</td><td>11001110</td></tr><tr><td>15</td><td>f</td><td>00001111</td><td> </td><td>79</td><td>4f</td><td>01001111</td><td> </td><td>143</td><td>8f</td><td>10001111</td><td> </td><td>207</td><td>cf</td><td>11001111</td></tr><tr><td>16</td><td>10</td><td>00010000</td><td> </td><td>80</td><td>50</td><td>01010000</td><td> </td><td>144</td><td>90</td><td>10010000</td><td> </td><td>208</td><td>d0</td><td>11010000</td></tr><tr><td>17</td><td>11</td><td>00010001</td><td> </td><td>81</td><td>51</td><td>01010001</td><td> </td><td>145</td><td>91</td><td>10010001</td><td> </td><td>209</td><td>d1</td><td>11010001</td></tr><tr><td>18</td><td>12</td><td>00010010</td><td> </td><td>82</td><td>52</td><td>01010010</td><td> </td><td>146</td><td>92</td><td>10010010</td><td> </td><td>210</td><td>d2</td><td>11010010</td></tr><tr><td>19</td><td>13</td><td>00010011</td><td> </td><td>83</td><td>53</td><td>01010011</td><td> </td><td>147</td><td>93</td><td>10010011</td><td> </td><td>211</td><td>d3</td><td>11010011</td></tr><tr><td>20</td><td>14</td><td>00010100</td><td> </td><td>84</td><td>54</td><td>01010100</td><td> </td><td>148</td><td>94</td><td>10010100</td><td> </td><td>212</td><td>d4</td><td>11010100</td></tr><tr><td>21</td><td>15</td><td>00010101</td><td> </td><td>85</td><td>55</td><td>01010101</td><td> </td><td>149</td><td>95</td><td>10010101</td><td> </td><td>213</td><td>d5</td><td>11010101</td></tr><tr><td>22</td><td>16</td><td>00010110</td><td> </td><td>86</td><td>56</td><td>01010110</td><td> </td><td>150</td><td>96</td><td>10010110</td><td> </td><td>214</td><td>d6</td><td>11010110</td></tr><tr><td>23</td><td>17</td><td>00010111</td><td> </td><td>87</td><td>57</td><td>01010111</td><td> </td><td>151</td><td>97</td><td>10010111</td><td> </td><td>215</td><td>d7</td><td>11010111</td></tr><tr><td>24</td><td>18</td><td>00011000</td><td> </td><td>88</td><td>58</td><td>01011000</td><td> </td><td>152</td><td>98</td><td>10011000</td><td> </td><td>216</td><td>d8</td><td>11011000</td></tr><tr><td>25</td><td>19</td><td>00011001</td><td> </td><td>89</td><td>59</td><td>01011001</td><td> </td><td>153</td><td>99</td><td>10011001</td><td> </td><td>217</td><td>d9</td><td>11011001</td></tr><tr><td>26</td><td>1a</td><td>00011010</td><td> </td><td>90</td><td>5a</td><td>01011010</td><td> </td><td>154</td><td>9a</td><td>10011010</td><td> </td><td>218</td><td>da</td><td>11011010</td></tr><tr><td>27</td><td>1b</td><td>00011011</td><td> </td><td>91</td><td>5b</td><td>01011011</td><td> </td><td>155</td><td>9b</td><td>10011011</td><td> </td><td>219</td><td>db</td><td>11011011</td></tr><tr><td>28</td><td>1c</td><td>00011100</td><td> </td><td>92</td><td>5c</td><td>01011100</td><td> </td><td>156</td><td>9c</td><td>10011100</td><td> </td><td>220</td><td>dc</td><td>11011100</td></tr><tr><td>29</td><td>1d</td><td>00011101</td><td> </td><td>93</td><td>5d</td><td>01011101</td><td> </td><td>157</td><td>9d</td><td>10011101</td><td> </td><td>221</td><td>dd</td><td>11011101</td></tr><tr><td>30</td><td>1e</td><td>00011110</td><td> </td><td>94</td><td>5e</td><td>01011110</td><td> </td><td>158</td><td>9e</td><td>10011110</td><td> </td><td>222</td><td>de</td><td>11011110</td></tr><tr><td>31</td><td>1f</td><td>00011111</td><td> </td><td>95</td><td>5f</td><td>01011111</td><td> </td><td>159</td><td>9f</td><td>10011111</td><td> </td><td>223</td><td>df</td><td>11011111</td></tr><tr><td>32</td><td>20</td><td>00100000</td><td> </td><td>96</td><td>60</td><td>01100000</td><td> </td><td>160</td><td>a0</td><td>10100000</td><td> </td><td>224</td><td>e0</td><td>11100000</td></tr><tr><td>33</td><td>21</td><td>00100001</td><td> </td><td>97</td><td>61</td><td>01100001</td><td> </td><td>161</td><td>a1</td><td>10100001</td><td> </td><td>225</td><td>e1</td><td>11100001</td></tr><tr><td>34</td><td>22</td><td>00100010</td><td> </td><td>98</td><td>62</td><td>01100010</td><td> </td><td>162</td><td>a2</td><td>10100010</td><td> </td><td>226</td><td>e2</td><td>11100010</td></tr><tr><td>35</td><td>23</td><td>00100011</td><td> </td><td>99</td><td>63</td><td>01100011</td><td> </td><td>163</td><td>a3</td><td>10100011</td><td> </td><td>227</td><td>e3</td><td>11100011</td></tr><tr><td>36</td><td>24</td><td>00100100</td><td> </td><td>100</td><td>64</td><td>01100100</td><td> </td><td>164</td><td>a4</td><td>10100100</td><td> </td><td>228</td><td>e4</td><td>11100100</td></tr><tr><td>37</td><td>25</td><td>00100101</td><td> </td><td>101</td><td>65</td><td>01100101</td><td> </td><td>165</td><td>a5</td><td>10100101</td><td> </td><td>229</td><td>e5</td><td>11100101</td></tr><tr><td>38</td><td>26</td><td>00100110</td><td> </td><td>102</td><td>66</td><td>01100110</td><td> </td><td>166</td><td>a6</td><td>10100110</td><td> </td><td>230</td><td>e6</td><td>11100110</td></tr><tr><td>39</td><td>27</td><td>00100111</td><td> </td><td>103</td><td>67</td><td>01100111</td><td> </td><td>167</td><td>a7</td><td>10100111</td><td> </td><td>231</td><td>e7</td><td>11100111</td></tr><tr><td>40</td><td>28</td><td>00101000</td><td> </td><td>104</td><td>68</td><td>01101000</td><td> </td><td>168</td><td>a8</td><td>10101000</td><td> </td><td>232</td><td>e8</td><td>11101000</td></tr><tr><td>41</td><td>29</td><td>00101001</td><td> </td><td>105</td><td>69</td><td>01101001</td><td> </td><td>169</td><td>a9</td><td>10101001</td><td> </td><td>233</td><td>e9</td><td>11101001</td></tr><tr><td>42</td><td>2a</td><td>00101010</td><td> </td><td>106</td><td>6a</td><td>01101010</td><td> </td><td>170</td><td>aa</td><td>10101010</td><td> </td><td>234</td><td>ea</td><td>11101010</td></tr><tr><td>43</td><td>2b</td><td>00101011</td><td> </td><td>107</td><td>6b</td><td>01101011</td><td> </td><td>171</td><td>ab</td><td>10101011</td><td> </td><td>235</td><td>eb</td><td>11101011</td></tr><tr><td>44</td><td>2c</td><td>00101100</td><td> </td><td>108</td><td>6c</td><td>01101100</td><td> </td><td>172</td><td>ac</td><td>10101100</td><td> </td><td>236</td><td>ec</td><td>11101100</td></tr><tr><td>45</td><td>2d</td><td>00101101</td><td> </td><td>109</td><td>6d</td><td>01101101</td><td> </td><td>173</td><td>ad</td><td>10101101</td><td> </td><td>237</td><td>ed</td><td>11101101</td></tr><tr><td>46</td><td>2e</td><td>00101110</td><td> </td><td>110</td><td>6e</td><td>01101110</td><td> </td><td>174</td><td>ae</td><td>10101110</td><td> </td><td>238</td><td>ee</td><td>11101110</td></tr><tr><td>47</td><td>2f</td><td>00101111</td><td> </td><td>111</td><td>6f</td><td>01101111</td><td> </td><td>175</td><td>af</td><td>10101111</td><td> </td><td>239</td><td>ef</td><td>11101111</td></tr><tr><td>48</td><td>30</td><td>00110000</td><td> </td><td>112</td><td>70</td><td>01110000</td><td> </td><td>176</td><td>b0</td><td>10110000</td><td> </td><td>240</td><td>f0</td><td>11110000</td></tr><tr><td>49</td><td>31</td><td>00110001</td><td> </td><td>113</td><td>71</td><td>01110001</td><td> </td><td>177</td><td>b1</td><td>10110001</td><td> </td><td>241</td><td>f1</td><td>11110001</td></tr><tr><td>50</td><td>32</td><td>00110010</td><td> </td><td>114</td><td>72</td><td>01110010</td><td> </td><td>178</td><td>b2</td><td>10110010</td><td> </td><td>242</td><td>f2</td><td>11110010</td></tr><tr><td>51</td><td>33</td><td>00110011</td><td> </td><td>115</td><td>73</td><td>01110011</td><td> </td><td>179</td><td>b3</td><td>10110011</td><td> </td><td>243</td><td>f3</td><td>11110011</td></tr><tr><td>52</td><td>34</td><td>00110100</td><td> </td><td>116</td><td>74</td><td>01110100</td><td> </td><td>180</td><td>b4</td><td>10110100</td><td> </td><td>244</td><td>f4</td><td>11110100</td></tr><tr><td>53</td><td>35</td><td>00110101</td><td> </td><td>117</td><td>75</td><td>01110101</td><td> </td><td>181</td><td>b5</td><td>10110101</td><td> </td><td>245</td><td>f5</td><td>11110101</td></tr><tr><td>54</td><td>36</td><td>00110110</td><td> </td><td>118</td><td>76</td><td>01110110</td><td> </td><td>182</td><td>b6</td><td>10110110</td><td> </td><td>246</td><td>f6</td><td>11110110</td></tr><tr><td>55</td><td>37</td><td>00110111</td><td> </td><td>119</td><td>77</td><td>01110111</td><td> </td><td>183</td><td>b7</td><td>10110111</td><td> </td><td>247</td><td>f7</td><td>11110111</td></tr><tr><td>56</td><td>38</td><td>00111000</td><td> </td><td>120</td><td>78</td><td>01111000</td><td> </td><td>184</td><td>b8</td><td>10111000</td><td> </td><td>248</td><td>f8</td><td>11111000</td></tr><tr><td>57</td><td>39</td><td>00111001</td><td> </td><td>121</td><td>79</td><td>01111001</td><td> </td><td>185</td><td>b9</td><td>10111001</td><td> </td><td>249</td><td>f9</td><td>11111001</td></tr><tr><td>58</td><td>3a</td><td>00111010</td><td> </td><td>122</td><td>7a</td><td>01111010</td><td> </td><td>186</td><td>ba</td><td>10111010</td><td> </td><td>250</td><td>fa</td><td>11111010</td></tr><tr><td>59</td><td>3b</td><td>00111011</td><td> </td><td>123</td><td>7b</td><td>01111011</td><td> </td><td>187</td><td>bb</td><td>10111011</td><td> </td><td>251</td><td>fb</td><td>11111011</td></tr><tr><td>60</td><td>3c</td><td>00111100</td><td> </td><td>124</td><td>7c</td><td>01111100</td><td> </td><td>188</td><td>bc</td><td>10111100</td><td> </td><td>252</td><td>fc</td><td>11111100</td></tr><tr><td>61</td><td>3d</td><td>00111101</td><td> </td><td>125</td><td>7d</td><td>01111101</td><td> </td><td>189</td><td>bd</td><td>10111101</td><td> </td><td>253</td><td>fd</td><td>11111101</td></tr><tr><td>62</td><td>3e</td><td>00111110</td><td> </td><td>126</td><td>7e</td><td>01111110</td><td> </td><td>190</td><td>be</td><td>10111110</td><td> </td><td>254</td><td>fe</td><td>11111110</td></tr><tr><td>63</td><td>3f</td><td>00111111</td><td> </td><td>127</td><td>7f</td><td>01111111</td><td> </td><td>191</td><td>bf</td><td>10111111</td><td> </td><td>255</td><td>ff</td><td>11111111</td></tr></tbody></table>

</div>

# Quiet Fans on Dell PowerEdge Servers Via IPMI

Link: https://blog.hessindustria.com/quiet-fans-on-dell-poweredge-servers-via-ipmi/

<div class="page-header" id="bkmrk-joshua-hess29-dec-20" style="text-align: justify;"><div class="container"><div class="row"><div class="col-lg-12"><div class="blog-details-page"><div class="post-author d-lg-flex justify-content-between pb-5"><div class="author-details  d-flex align-items-center"><div class="post-card-byline-content">[JOSHUA HESS](https://blog.hessindustria.com/author/joshua/)<span class="post-card-byline-date"><time datetime="2021-12-29">29 DEC 2021</time> <span class="bull">•</span> 3 MIN READ</span></div></div></div><div class="post-image image-flex mb-3 w-100">![Quiet Fans on Dell PowerEdge Servers Via IPMI](https://blog.hessindustria.com/content/images/2021/12/dell_poweredge.jpg)</div></div></div></div></div></div><main id="bkmrk-intro-you-just-got-y">## Intro

You just got your new shiny Dell PowerEdge server all set up, but you are getting annoyed by the constant fan ramping up and down or the louder than desired whining of fans. Or worse yet, you just added an "unsupported" GPU or another PCIe device to your PowerEdge and now the fans are ripping at near 100% and screaming away like a jet engine. Fear not! This quick tutorial will get your server to STFU in no time!

When I first got into servers and HomeLab years ago, the standard and accepted way to quiet down PowerEdge servers was to add a resistor in series with each of the fans. Luckily, the newer generations of PowerEdge servers since then have a standard IPMI interface and some known commands to manually control the fan speed. No resistors or soldering irons required this time, nice.

## Step By Step

### Before We Begin

Before starting, you'll need to:

<div class="main-centent-area post-details-wrapper section-padding pt-4 clearfix" style="text-align: justify;"><div class="container"><div class="row"><div class="col-md-10 mx-auto"><div class="entry-content">1. Have access to a Linux machine (Ubuntu recommended)
2. Know your Dell iDRAC IP address and login credentials
3. Make sure IPMI Over LAN option is enabled in iDRAC as shown below

<figure class="kg-card kg-image-card">![](https://blog.hessindustria.com/content/images/2021/12/image-2.png)</figure></div></div></div></div></div>### Install IPMI Tool

The first thing to do is install IPMI Tool. To do so, open a terminal and run the following command:

```
sudo apt install ipmitool
```

This is what we will use to send raw IPMI commands to the server.

### Enter Manual Fan Control Mode

To put the fan speed controller into manual or fixed speed mode, run the following command with your own iDRAC IP and credentials:

```
ipmitool -I lanplus -H <ip> -U <user> -P <pass> raw 0x30 0x30 0x01 0x00
```

### Set Static Fan Speed

To set a static fan speed run the following command with your own iDRAC IP, credentials, and fan speed as a percentage (0-100) in hexadecimal format (0x00-0x64).

```
ipmitool -I lanplus -H <ip> -U <user> -P <pass> raw 0x30 0x30 0x02 0xFF <speed>
```

For example, setting the speed to 10% (0xA) would be as follows:

```
ipmitool -I lanplus -H <ip> -U <user> -P <pass> raw 0x30 0x30 0x02 0xFF 0xA
```

**NOTE:** The static fan speed commands only work if the speed controller is set in manual mode as set above. It will return to automatic mode upon an iDRAC reset.

### Maximizing Sound Reduction

It may be counterintuitive, but to minimize sound level, lower fan speed isn't always better. In my case, with the R730 server, I found that the optimum fan speed for minimum perceived sound was 11% fan speed. I found that the lower speeds had a lower frequency sound which was actually more noticeable than the higher frequency whine at slightly higher speeds. It's worth sweeping through the speeds on your setup and finding the highest speed with an acceptable sound level.

### Double Check Your Temps

The downside to setting the fans to a static speed is, of course, reduced cooling performance and no reaction during high load. In my case, this was not an issue since my server never goes near full load and my ambient temperatures are consistently quite low. However, it is worth double-checking your temperatures and running some synthetic loads to see what the worse case would look like. You can find most of the critical temperatures exposed in the iDRAC web interface.

### Final Thoughts

This method worked great for me and I have used this on all my servers in my home lab. I took this one step further and made a bash script that I can call at a moment's notice if the settings get reset. This can happen if the iDRAC is reset in any way (FW update, SW reset, sustained power outage). You can see the simple bash script below for reference:

```
#!/bin/bash
ipmitool -I lanplus -H <ip> -U <user> -P <pass> raw 0x30 0x30  0x01 0x00
ipmitool -I lanplus -H <ip> -U <user> -P <pass> raw 0x30 0x30 0x02 0xFF 0xB
echo Server STFU done!

```

That's it! I hope this was helpful and saves some headaches and bleeding ears for fellow PowerEdge owners.

</main>

# Dell Fan Noise Control - Silence Your Poweredge

<div class="px-md xs:px-0" id="bkmrk-"></div>Link: [https://www.reddit.com/r/homelab/comments/7xqb11/dell\_fan\_noise\_control\_silence\_your\_poweredge/](https://www.reddit.com/r/homelab/comments/7xqb11/dell_fan_noise_control_silence_your_poweredge/)

Hey,

there were some threads complaining about server noise in this sub the last days. I did some research on how to manually controlling the PowerEdge fans.

I read threads on this sub and other boards and found a lot of commands. These are already widely known, but I wanted to list them again. Maybe they will help others.

I tested them with my R210II, T620 and T330. So basically a 11th, 12th and 13th generation PowerEdge. Although you might have to change the sensors' names accordingly.

```
### Dell Fan Control Commands
#
#
# Hex to Decimal: http://www.hexadecimaldictionary.com/hexadecimal/0x1a/
#
#
# print temps and fans rpms
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> sensor reading "Ambient Temp" "FAN 1 RPM" "FAN 2 RPM" "FAN 3 RPM"
#
# print fan info
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> sdr get "FAN 1 RPM" "FAN 2 RPM" "FAN 3 RPM"
#
# enable manual/static fan control
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> raw 0x30 0x30 0x01 0x00
#
# disable manual/static fan control
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> raw 0x30 0x30 0x01 0x01
#
# set fan speed to 0 rpm
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> raw 0x30 0x30 0x02 0xff 0x00
#
# set fan speed to 20 %
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> raw 0x30 0x30 0x02 0xff 0x14
#
# set fan speed to 30 %
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> raw 0x30 0x30 0x02 0xff 0x1e
#
# set fan speed to 100 %
ipmitool -I lanplus -H <iDRAC-IP> -U <iDRAC-USER> -P <iDRAC-PASSWORD> raw 0x30 0x30 0x02 0xff 0x64
```

I wrote a small script, that will check the servers temperature periodically (crontab) and disables or enables the dynamic fan control based on a temperature threshold. You may have to adjust the time frame depending on your server usage.

```
#!/bin/bash
#
# crontab -l > mycron
# echo "#" >> mycron
# echo "# At every 2nd minute" >> mycron
# echo "*/2 * * * * /bin/bash /scripts/dell_ipmi_fan_control.sh >> /tmp/cron.log" >> mycron
# crontab mycron
# rm mycron
# chmod +x /scripts/dell_ipmi_fan_control.sh
#
DATE=$(date +%Y-%m-%d-%H%M%S)
echo "" && echo "" && echo "" && echo "" && echo ""
echo "$DATE"
#
IDRACIP="<iDRAC-IP>"
IDRACUSER="<iDRAC-USER>"
IDRACPASSWORD="<iDRAC-PASSWORD>"
STATICSPEEDBASE16="0x0f"
SENSORNAME="Ambient"
TEMPTHRESHOLD="29"
#
T=$(ipmitool -I lanplus -H $IDRACIP -U $IDRACUSER -P $IDRACPASSWORD sdr type temperature | grep $SENSORNAME | cut -d"|" -f5 | cut -d" " -f2)
# T=$(ipmitool -I lanplus -H $IDRACIP2 -U $IDRACUSER -P $IDRACPASSWORD sdr type temperature | grep $SENSORNAME2 | cut -d"|" -f5 | cut -d" " -f2 | grep -v "Disabled")
echo "$IDRACIP: -- current temperature --"
echo "$T"
#
if [[ $T > $TEMPTHRESHOLD ]]
  then
    echo "--> enable dynamic fan control"
    ipmitool -I lanplus -H $IDRACIP -U $IDRACUSER -P $IDRACPASSWORD raw 0x30 0x30 0x01 0x01
  else
    echo "--> disable dynamic fan control"
    ipmitool -I lanplus -H $IDRACIP -U $IDRACUSER -P $IDRACPASSWORD raw 0x30 0x30 0x01 0x00
    echo "--> set static fan speed"
    ipmitool -I lanplus -H $IDRACIP -U $IDRACUSER -P $IDRACPASSWORD raw 0x30 0x30 0x02 0xff $STATICSPEEDBASE16
fi
```

<div class="text-neutral-content" id="bkmrk--1" slot="text-body" style="text-align: justify;"><div class="mb-sm  mb-xs px-md xs:px-0" data-post-click-location="text-body"><div class="md text-14" id="bkmrk--2"></div></div></div>

# brezlord/iDRAC7_fan_control

<div class="repository-content " id="bkmrk-"><div class="clearfix container-xl px-md-4 px-lg-5 px-3"><div><div class="Layout Layout--flowRow-until-md react-repos-overview-margin Layout--sidebarPosition-end Layout--sidebarPosition-flowRow-end" data-view-component="true"><div class="Layout-main" data-view-component="true"><div data-target="react-partial.reactRoot"><div class="Box-sc-g0xbh4-0 izjvBm"><div class="Box-sc-g0xbh4-0 eLcVee"><div class="Box-sc-g0xbh4-0 hsfLlq"><div class="Box-sc-g0xbh4-0 laYubZ"></div></div></div></div></div></div></div></div></div></div><div class="repository-content " id="bkmrk-link%3A-https%3A%2F%2Fgithub"><div class="clearfix container-xl px-md-4 px-lg-5 px-3"><div class="Layout Layout--flowRow-until-md react-repos-overview-margin Layout--sidebarPosition-end Layout--sidebarPosition-flowRow-end" data-view-component="true"><div class="Layout-main" data-view-component="true"><div data-target="react-partial.reactRoot"><div class="Box-sc-g0xbh4-0 izjvBm"><div class="Box-sc-g0xbh4-0 yfPnm"><div class="Box-sc-g0xbh4-0 ehcSsh"><div class="Box-sc-g0xbh4-0 iGmlUb"><div class="Box-sc-g0xbh4-0 iRQGXA"><nav aria-label="Repository files" class="Box-sc-g0xbh4-0 dvTdPK"></nav></div><div class="Box-sc-g0xbh4-0 bJMeLZ js-snippet-clipboard-copy-unpositioned" data-hpc="true"><article class="markdown-body entry-content container-lg">Link: [https://github.com/brezlord/iDRAC7\_fan\_control](https://github.com/brezlord/iDRAC7_fan_control)

A simple script to control fan speeds on Dell generation 12 PowerEdge servers.  
If the monitored temperature is above 35deg C enable iDRAC dynamic control and exit program.  
If monitored temperature is below 35deg C set fan control to manual and set fan speed to predetermined value.  
The tower servers T320, T420 &amp; T620 inlet temperature sensor is after the HDDs so temperature will be higher than the ambient temperature.

As you may have discovered, when you cross flash a Dell H310 raid controller to IT mode and as soon as the iDRAC detects that a drive has been inserted the fans spin up and get loud even when the ambient temperature is low, say 20deg C. This is as designed by Dell, which sucks.

#### Directly from page 30 PowerEdge T320 Technical Guide

<div class="markdown-heading" dir="auto" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/brezlord/iDRAC7_fan_control#directly-from-page-30-poweredge-t320-technical-guide)</div>*RAID Setup with PERC H310: A system configured as non-RAID has a higher noise level than a system configured as RAID. With non-RAID, the temperature of the hard disk drives is not monitored, which causes the fan speed to be higher to ensure sufficient cooling resulting in higher noise level*

There is no warranty provided and you use this scrip at your own risk. Please ensure you review the temperature set points for your use case to ensure your hard drives are kept at your desired temperature, change the set points as needed. I suggest that you trend you HDD temps to validate your setting and that you setup alarms in TrueNAS so that you get warnings if the HDD temperatures get to high.

I use this script on a Dell T320 running TrueNAS 12 and it work great. The server lives in my garage, which in Western Australia can get into the low 40s deg C.

You will need to create a data set for the script to reside in and make it executable, this assumes that you have a pool called tank and a dataset named fan\_control.

```
chmod +x /mnt/tank/fan_control/fan_control.sh

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>Make sure you set the below variables;

```
IDRAC_IP="IP address of iDRAC"
IDRAC_USER="user"
IDRAC_PASSWORD="passowrd"

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>There are multiple temperature sensors that you can choose to use. Just uncomment the one you would like the script to monitor. Not all temperature sensors are available in some models. You can run the following command from the shel to list all of the available temperature sensors on you generation 12 Dell sever.

```
ipmitool -I lanplus -H <ip address> -U <username> -P <password> sdr type temperature

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>Output from a Dell T320

```
Inlet Temp       | 04h | ok  |  7.1 | 23 degrees C
Temp             | 0Eh | ok  |  3.1 | 33 degrees C
Temp             | 0Fh | ns  |  3.2 | Disabled

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>Output from a Dell R720

```
Inlet Temp       | 04h | ok  |  7.1 | 20 degrees C
Exhaust Temp     | 01h | ok  |  7.1 | 31 degrees C
Temp             | 0Eh | ok  |  3.1 | 50 degrees C
Temp             | 0Fh | ok  |  3.2 | 45 degrees C

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>You will need to enable IPMI in the iDRAC and the user must have administrator privileges.

You can test the script by running ./fan\_control.sh from the scrips directory. If it is working you should get an output similar to this;

```
Date 04-09-2020 10:24:52
--> iDRAC IP Address: 192.168.40.140
--> Current Inlet Temp: 22
--> Temperature is below 35deg C
--> Disabled dynamic fan control

--> Setting fan speed to 20%

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>Once you have verified the script is working you can set it to run every 5 minutes via cron.

On TrueNAS Core this can be found under the Tasks menu --&gt; Cron Jobs.

On TrueNAS Scale this can be found under the System menu --&gt; Advanced Cron Jobs tab.

## Systemd

<div class="markdown-heading" dir="auto" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/brezlord/iDRAC7_fan_control#systemd)</div>## Running as a service

<div class="markdown-heading" dir="auto" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/brezlord/iDRAC7_fan_control#running-as-a-service)</div>Once the service is up and running, the temprature will be checked every `INTERVAL_SEC` seconds. Fan speed will change if the temprature has changed and warrants a speed change.

There is a delay before the temprature monitoring begins and is controlled by the variable `INITIAL_START_DELAY_SEC`. After this initial delay the time between checks is governed by the `INTERVAL_SEC` value.

When the server is shutdown/rebooted or started, the manual control is reset, this is to avoid any left over low fan speeds from previous power outage/powerdown/shutdown etc.

The files required to run the service are `fan_control_dyn.sh` `fancontrol.service`

Simply execute the following to get the service set up.

```
sudo cp fan_control_dyn.sh /usr/local/sbin/fan_control_dyn.sh
sudo chmod 755 /usr/local/sbin/fan_control_dyn.sh
sudo cp fancontrol.service /etc/systemd/system/fancontrol.service
sudo systemctl enable fancontrol.service
sudo systemctl start fancontrol.service

```

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>If you are using a location other than `/usr/local/sbin/fan_control_dyn.sh` then you'll need to modify the location in the `fancontrol.service` file as well

```
ExecStart=/MY_ABSOLUTE_PATH/fan_control_dyn.sh
```

</article></div></div></div></div></div></div></div></div></div></div>

# Dell PowerEdge T620 : How To Reduce FAN Speed with IPMI

Link: [https://std.rocks/dell\_t620\_fanspeed.html](https://std.rocks/dell_t620_fanspeed.html)

- *Last updated: Feb 8, 2022*

![Dell logo](https://std.rocks/images/dell_ipmi/002.svg)![Dell PowerEdge T620](https://std.rocks/images/dell_ipmi/004.png)

Recently I had to replace **Dell** certified mechanical **hard drives** with uncertified **SSD** drives on a **PowerEdge T620** server and was unpleasantly suprised to find that the fans were spinning noisly when inserted.

After quick research, I discovered that it was a known issue and that **Dell** wasn't able to offer any [solution](https://www.dell.com/community/Systems-Management-General/PowerEdge-T620-Fan-Speed-75-after-installing-SSD/td-p/5136373)…

Thanks to god/internet, I also found a post where a user has been able to control the fan speed with the **ipmitool**. So, big thanks to, [tatmde](https://www.reddit.com/r/homelab/comments/7xqb11/dell_fan_noise_control_silence_your_poweredge/).

I will simply post here what I have done in my situation.

⚠️ <span class="red">Be advised that changing the fan speed may result in overheating and damage to the components.</span> ⚠️

<section id="bkmrk-enable-ipmi-over-lan"><section>## Enable IPMI over LAN

To control the **FANs speed** via network we need to enable **IPMI over LAN** from **IDRAC**.

⚠️ Enable **IPMI over LAN** could be considered as security issue cause a remote station would have the capability to control the system's power state as well as being able to gather certain platform information. ⚠️

- Connect to your **iDRAC**, go to **iDRAC Settings** &gt; **Network** and enable **IPMI Over LAN** :

![Dell IDRAC | enable IPMI](https://std.rocks/images/dell_ipmi/001.png)</section><section>## ipmitool utility

### Installing on GNU/Linux

Install **ipmitool** software. This utility will allow us to communicate with the **IPMI**.

- From a **Debian** you could use this command to install **ipmitool** :

```
root@host:~# apt-get install ipmitool
```

### Using ipmitool

#### Check temperature

- Get **temperature** informations :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr type temperature
Inlet Temp       | 04h | ok  |  7.1 | 21 degrees C
Temp             | 0Eh | ok  |  3.1 | 29 degrees C
Temp             | 0Fh | ok  |  3.2 | 35 degrees C
```

- We can see the corresponding values in **iDRAC** :

![Dell IDRAC | temperature probes](https://std.rocks/images/dell_ipmi/005.png)#### Control FAN Speed

- To disable **manual**/**static** fan control (auto mode) :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x01 0x01
```

- To enable **manual**/**static** fan control (manual mode) :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x01 0x00
```

- Get current **Fan** speed :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr get Fan1 Fan2 | grep "Sensor Reading"
 Sensor Reading        : 1560 (+/- 120) RPM
 Sensor Reading        : 1560 (+/- 120) RPM
```

- Set **Fan** speed at **1320 RPM (16%)** :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x02 0xff 0x10
```

- Set **Fan** speed at **1560 RPM (20%)** :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x02 0xff 0x14
```

- Set **Fan** speed at **2040 RPM (30%)** :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x02 0xff 0x1e
```

- Set **Fan** speed at **3000 RPM (50%)** :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x02 0xff 0x32
```

- Set **Fan** speed at **5040 RPM (100%)** :

```
user@host:~$ ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x02 0xff 0x64
```

</section><section>## Create ipmi service

I got mad and decided to create a **service** that automatically regulates the **speed** of the **fans**.

I will detail here the different **steps** to set it up.

*Note : This script is adapted to my own configuration*

### Create system account

- For **security** reason I decided to run the service with **system account**. So let's create a **system** account :

```
root@host:~# useradd --system --no-create-home ipmiservice
```

- Create **log** folder :

```
root@host:~# mkdir /var/log/ipmiservice
```

```
root@host:~# chown -R ipmiservice /var/log/ipmiservice
```

### Create bash script

- Create **/usr/local/sbin/ipmiservice.sh** file :

```
root@host:~# touch /usr/local/sbin/ipmiservice.sh
```

```
root@host:~# chown ipmiservice: /usr/local/sbin/ipmiservice.sh
```

```
root@host:~# chmod +x /usr/local/sbin/ipmiservice.sh
```

- **/usr/local/sbin/ipmiservice.sh** :

```
#!/bin/bash 

#Stops script on errors, unset variables or failing pipeline 
set -euo pipefail

#variables definitions 
LOG=/var/log/ipmiservice/ipmi.log
IP="192.168.1.10"
PASSWORD='STp@ssw0rd!'

#functions 
##Set Fan Speed, accept one argument to set speed 
FanSpeed()
{
        ipmitool -I lanplus -H "$IP" -U root -P "$PASSWORD" raw 0x30 0x30 0x02 $1
}
##Get Temp values 
GetValues()
{
        #Get motherboard, cpu1 and cpu2 temperature 
        OUTPUT=$(/usr/bin/ipmitool -I lanplus -H "$IP" -U root -P "$PASSWORD" sdr type temperature | sed -e 's/Temp\(.*0Eh\)/Cpu1\1/' -e 's/Temp\(.*0Fh\)/Cpu2\1/')
        #Extract motherboard temp 
        SB=$(echo $OUTPUT| awk -F'|' '{ print $5 $9 $13 }' | awk '{ print $1 }')
        #Extract cpu1 temp 
        CPU1=$(echo $OUTPUT| awk -F'|' '{ print $5 $9 $13 }' | awk '{ print $5 }')
        #Extract cpu2 temp 
        CPU2=$(echo $OUTPUT| awk -F'|' '{ print $5 $9 $13 }' | awk '{ print $9 }')
        #motherboard+cpu1+cpu2 temp 
        LOG_TOTAL=$(($SB+$CPU1+$CPU2))
        #Get Fan1 speed 
        FANS=$(ipmitool -I lanplus -H "$IP" -U root -P "$PASSWORD" sensor reading Fan1 | awk '{ print $3 }')
}

#set manual mode 
ipmitool -I lanplus -H "$IP" -U root -P "$PASSWORD" raw 0x30 0x30 0x01 0x00

GetValues
echo "$(date "+%Y-%m-%d %H:%M:%S")" "MB : $SB | CPU1 : $CPU1 | CPU2 : $CPU2 | LOG_TOTAL : $LOG_TOTAL"

while :
do
        if [ "$LOG_TOTAL" -le 100 ] && [ $FANS -eq 1440 ]; then
                echo "$(date "+%Y-%m-%d %H:%M:%S")" "FAN speed : 1440, don't do anything" | tee -a "$LOG"
        elif [ "$LOG_TOTAL" -le 100 ] && [ $FANS -ne 1440 ]; then
                FanSpeed "0xff 0x12" #Set speed to 1440 
                echo "$(date "+%Y-%m-%d %H:%M:%S")" "Set speed to 1440" | tee -a "$LOG"
        elif [ "$LOG_TOTAL" -gt 100 ] && [ "$LOG_TOTAL" -le 105 ] && [ $FANS -ne 1560 ]; then
                FanSpeed "0xff 0x14" #Set speed to 1560 
                echo "$(date "+%Y-%m-%d %H:%M:%S")" "Set speed to 1560" | tee -a "$LOG"
        elif [ "$LOG_TOTAL" -gt 105 ] && [ "$LOG_TOTAL" -le 115 ] && [ $FANS -ne 2040 ]; then
                FanSpeed "0xff 0x1e" #Set speed to 2040 
                echo "$(date "+%Y-%m-%d %H:%M:%S")" "Set speed to 2040" | tee -a "$LOG"
        elif [ "$LOG_TOTAL" -gt 115 ] && [ "$LOG_TOTAL" -le 130 ] && [ $FANS -ne 3000 ]; then
                FanSpeed "0xff 0x32" #Set speed to 3000 
                echo "$(date "+%Y-%m-%d %H:%M:%S")" "Set speed to 3000" | tee -a "$LOG"
        elif [ "$LOG_TOTAL" -gt 130 ] && [ $FANS -ne 5040 ]; then
                FanSpeed "0xff 0x64" #Set speed to 5040 
                echo "$(date "+%Y-%m-%d %H:%M:%S")" "Set speed to 5040" | tee -a "$LOG"
        fi
        sleep 30s
        GetValues
        echo "$(date "+%Y-%m-%d %H:%M:%S")" "MB : $SB | CPU1 : $CPU1 | CPU2 : $CPU2 | TEMP TOTAL : $LOG_TOTAL" >> "$LOG"
        echo "$(date "+%Y-%m-%d %H:%M:%S")" "FAN speed : $FANS" | tee -a "$LOG"
done
```

### Create systemd service

Now we will create a **systemd** service.

- Create **systemd** service :

```
root@host:~# vim /etc/systemd/system/ipmi.service
```

```
[Unit]
Description=ipmi t620 fan control
After=network.target

[Service]
Type=simple
User=ipmiservice
Group=ipmiservice
WorkingDirectory=/usr/local/sbin/
ExecStart=/usr/local/sbin/ipmiservice.sh
Restart=always

[Install]
WantedBy=multi-user.target
```

- Enable **systemd** service :

```
root@host:~# systemctl enable ipmi.service
```

- Start **systemd** service :

```
root@host:~# systemctl start ipmi.service
```

- Check **logs** output :

```
root@host:~# tail -f /var/log/ipmiservice/ipmi.log
2021-05-09 15:16:57 FAN speed : 1440, don't do anything
2021-05-09 15:17:32 MB : 22 | CPU1 : 37 | CPU2 : 40 | TEMP TOTAL : 99
2021-05-09 15:17:32 FAN speed : 1440, don't do anything
2021-05-09 15:18:04 MB : 22 | CPU1 : 38 | CPU2 : 40 | TEMP TOTAL : 100
2021-05-09 15:18:04 FAN speed : 1440, don't do anything
2021-05-09 15:18:36 MB : 22 | CPU1 : 39 | CPU2 : 40 | TEMP TOTAL : 101
2021-05-09 15:18:36 FAN speed : 1440, don't do anything
2021-05-09 15:18:37 Set speed to 1560
2021-05-09 15:19:09 MB : 22 | CPU1 : 38 | CPU2 : 40 | TEMP TOTAL : 100
2021-05-09 15:19:09 FAN speed : 1560
```

</section></section>

# dell-idrac-6-fan-speed-control-service

Link: [hippyod/dell-idrac-6-or-7-fan-speed-control-service: Simple service to monitor ambient temp of Dell PowerEdge R610 or R720 (iDRAC 6 or 7) and set fan speed manually and appropiately via IPMI (github.com)](https://github.com/hippyod/dell-idrac-6-or-7-fan-speed-control-service)

git clone [https://github.com/hippyod/dell-idrac-6-or-7-fan-speed-control-service.git](https://github.com/hippyod/dell-idrac-6-or-7-fan-speed-control-service.git)

Simple service to monitor ambient temp of Dell PowerEdge R610 or R720 (iDRAC 6 &amp; 7) and set fan speed manually and appropiately via IPMI.

This service will start on boot, monitor the average core CPU temperature every 30s, and adjust fan speed over LAN via the ipmitool based on a rolling average of the average CPU temperatures every two minutes; i.e. `${AVG_CPU_TEMPS_ARRAY_SUM}/4`

**\[NOTE: if you don't understand the instructions, that's what internet search is for.\]**

1. Make sure ipmitool and lm\_sensors is installed; e.g.  
    `sudo dnf install ipmitool lm_sensors`
2. Make sure iDRAC is enabled over lan from the host OS
3. Get the IP address of iDRAC from the LCD menus at the front of the screen, or during boot
4. Enter the iDRAC IP address, username, and password in fan-speed-control.sh 
    1. We suggest making the IP address static
    2. We suggest changing the root/calvin default username and password on iDRAC first if you haven't already done so
    3. If the fan isn't under control by the time your login screen comes up, check the IP address first
5. `sudo sensors-detect`
    1. Hit enter all the way through until it asks you to write out the results of the probe unless you know what you're doing
6. `sudo cp fan-speed-control.sh /usr/local/bin/`
7. `sudo cp fan-speed-control.service /usr/lib/systemd/system/`
8. `sudo systemctl enable /usr/lib/systemd/system/fan-speed-control.service`
9. `sudo systemctl start fan-speed-control.service`

The service will start and run every 5 seconds until a proper temperature average is calculated, and then every 30 seconds (default), adjusting the fan speed appropiately as the average core CPU temperature rises. Minimum rotation is set to 15%. Once the temp rises past 90% of the high CPU temperature as reported by the sensors command, it will return control to iDRAC until the core CPU average temperature falls back under 90% of the reported high. *Please read through the script to understand the default settings, and to adjust the IP address of your iDRAC.*

This stopped my machine (first a Dell Poweredge R610, and later a R720) from sounding like a jet engine, but it still sounds like a loud, '90's era desktop with this. Still much better and much more tolerable. Expect the fan speed to adjust somewhat regularly depending on usage and sensor sensistivity, and adjust the way the service works to your heart's desire, but see warning and disclaimer below. Occasionally the sensors may miss a beat, which will cause the script to fail. The script is designed to restart the service until fixed.

### DISCLAIMER

<div class="markdown-heading" dir="auto" id="bkmrk-" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/hippyod/dell-idrac-6-or-7-fan-speed-control-service#disclaimer)</div>#### USE AT YOUR OWN RISK!! No responsibility taken for any damage caused to your equipment as result of this script.

<div class="markdown-heading" dir="auto" id="bkmrk--2" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/hippyod/dell-idrac-6-or-7-fan-speed-control-service#use-at-your-own-risk--no-responsibility-taken-for-any-damage-caused-to-your-equipment-as-result-of-this-script)</div>Original script before modification can be found and freely obtained from [NoLooseEnds](https://github.com/NoLooseEnds/Scripts)

# REDUCE THE FAN NOISE OF THE DELL R720XD (PLUS OTHER 12TH GEN SERVERS) WITH IPMI

Link: [https://blog.filegarden.net/2020/10/06/reduce-the-fan-noise-of-the-dell-r720xd-plus-other-12th-gen-servers-with-ipmi/](https://blog.filegarden.net/2020/10/06/reduce-the-fan-noise-of-the-dell-r720xd-plus-other-12th-gen-servers-with-ipmi/)

<header class="entry-header" id="bkmrk-%C2%A0october-6%2C-2020%C2%A0%C2%A0sp">#####  [<time class="entry-date" datetime="2020-10-06T06:11:08-05:00">October 6, 2020 </time>](https://blog.filegarden.net/2020/10/06/reduce-the-fan-noise-of-the-dell-r720xd-plus-other-12th-gen-servers-with-ipmi/ "6:11 am")<span class="byline"> <span class="author vcard">[Spencer LeB](https://blog.filegarden.net/author/sleblanc/ "View all posts by Spencer LeB")</span></span>

</header>## Introduction

In this guide I will be showing you how you can reduce the fan noise of the Dell Powerdge r720XD. This will probably work on the r720 and other 12th gen dell servers. To do this, we will be using IPMI to manually override the fan speed.

### Requirements

In order to follow this guide, you will need the following:

<div class="entry-content" id="bkmrk-a-linux-machine-%28or-" style="text-align: justify;">- A Linux machine (or anything with `ipmitool` available)
- 12th gen Dell Poweredge Server with iDRAC 7

</div>### Disclaimer

Make sure you keep an eye out on the temperatures of the server or else it will overheat and could cause hardware damage. If you brick your server, thats your problem!

## Getting setup

### Enabling IPMI

The first thing you will need to do is connect to the iDRAC interface on your dell server. You can do so by entering the IP address of the DRAC in a browser. If you are unsure on the IP address, you can find it by powering on the server, pressing F2 to enter the system setup, go to the DRAC section and find the IP somewhere in there. You then need to login. the default credentials are username `root` and password `calvin`.

Once logged in, you will need to go to `Overview -> iDRAC Settings -> Network` and then scroll to the IMPI Settings. You will need to make sure this is enabled.

<div class="entry-content" id="bkmrk-" style="text-align: justify;"><figure class="wp-block-image">![](https://back2basics.io/wp-content/uploads/2020/05/enable_ipmi.png)</figure></div>### Installing IPMI tool

First of all, check if you already have `ipmitool` installed. If you do, you can skip this step. If not, lets install it.

If you are on a debian based machine, you can use apt to install it. First, lets update our apt repo.

```
sudo apt update
```

Now lets install it

```
sudo apt install ipmitool
```

## Controlling some fans

### Enabling manual fan control

Once IPMI has been enabled, we now need to enable remote fan control. We can do so with this command. Make sure to replace the IP, username and password for your system.

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x01 0x00
```

### Setting the speed

You may not have noticied a difference in the sound yet but dont worry, we can now override the current fan speed with our own. Prepare yourself! Use this command to set the fan speed to 20%.

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x02 0xff 0x14
```

If you cant hear the difference or you would like to check the current speed, you can do so via the iDRAC system. go to `Overview -> Hardware -> Fans`.

<div class="entry-content" id="bkmrk--1" style="text-align: justify;"><figure class="wp-block-image">![](https://back2basics.io/wp-content/uploads/2020/05/fan_speeds.png)</figure></div>### Custom speeds

If you want to change the speed to something other than 20%, you just need to change the value at the end from `0x14` to whatever you’d like. `0x14` is the hexadecimal value for 20. Here are some premade values for you. If your not sure how to work out hexadecimal values, check out this [website](https://www.rapidtables.com/convert/number/decimal-to-hex.html).

### Set fan speed to 25%

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x02 0xff 0x19
```

### Set fan speed to 30%

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x02 0xff 0x1E
```

### Set fan speed to 50%

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x02 0xff 0x32
```

### Set fan speed to 60%

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x02 0xff 0x3C
```

### Set fan speed to 100%

```
ipmitool -I lanplus -H SERVERS_IP_HERE -U IDRAC_USERNAME -P 'IDRAC_PASSWORD_HERE' raw 0x30 0x30 0x02 0xff 0x64
```

Original Author  
[https://back2basics.io/2020/05/reduce-the-fan-noise-of-the-dell-r720xd-plus-other-12th-gen-servers-with-ipmi/](https://back2basics.io/2020/05/reduce-the-fan-noise-of-the-dell-r720xd-plus-other-12th-gen-servers-with-ipmi/)

<footer class="entry-footer" id="bkmrk--2">---

<div class="row"><div class="col-md-6 cattegories" style="text-align: justify;">  
</div></div></footer>

# Verificação de Status - Linux

# How to Check CPU Information on Linux?

Link: [https://www.scaler.com/topics/cpu-info-linux/](https://www.scaler.com/topics/cpu-info-linux/)

<div class="relative article-author_tooltipContainer__LSaMQ" id="bkmrk-by-eshika-shah-7-min" style="text-align: justify;"><div><div class="article-author_author_name__C_DzB">By Eshika Shah <span class="flex-c column">7 mins read </span><span class="row flex-c"><span class="">Last updated: 18 Jul 2023</span></span></div></div></div><div class="markdown-body" id="bkmrk-overview-checking-cp" style="text-align: justify;"><section class="abstract">##### **Overview**

Checking CPU information on Linux is an essential task for understanding your system's hardware configuration and capabilities. The <span class="highlight--red">CPU (Central Processing Unit)</span> is a crucial component that performs calculations executes instructions, and manages system resources. You can gather details such as the CPU model, architecture, clock speed, number of cores, cache size, and supported features by checking CPU information.

</section><section class="main">#### **Introduction**

Linux provides various methods to get CPU info linux, from simple commands to more advanced tools. These methods offer different levels of detail and flexibility, allowing you to choose the one that suits your needs. By exploring these methods, you can gain valuable insights into your CPU and optimize your system accordingly.

Some commonly used methods to get CPU info linux include using commands like "lscpu," "<span class="highlight--red">cat /proc/cpuinfo</span>," "top" or "htop," "nproc," and utilizing tools such as <span class="highlight--red">"hardinfo," "hwinfo," "dmidecode," "inxi," and "lshw."</span> Each method provides specific information about the CPU, enabling you to analyze its capabilities and make informed decisions.

To get CPU info linux is beneficial in various scenarios. It helps system administrators understand the system's performance characteristics, identify hardware limitations, and plan resource allocation. Developers and software enthusiasts can utilize CPU information to optimize applications for specific CPU architectures and features. Additionally, troubleshooting performance issues, diagnosing compatibility problems, and monitoring system utilization is also facilitated by checking CPU information.

In the following sections, we will delve into each method to get CPU info linux, providing step-by-step instructions and explanations on how to use them effectively. By understanding these methods, you will be equipped with the knowledge to gather comprehensive CPU information and make informed decisions based on your system's hardware capabilities.

It's important to note that the specific commands and tools mentioned in this guide may vary depending on your Linux distribution. However, the underlying concepts and approaches remain consistent across distributions.

Checking CPU information on Linux allows you to understand the characteristics and capabilities of your system's CPU. It provides crucial insights for system optimization, troubleshooting, and resource allocation. Utilizing various commands and tools in the Linux ecosystem allows you to gather detailed information about the CPU model, architecture, clock speed, cores, cache size, and supported features. With this knowledge, you can make informed decisions to maximize your system's performance and compatibility.

</section><section class="main">#### **Methods to Get CPU Information on Linux**

#### Using lscpu Command

The <span class="highlight--red">lscpu</span> command provides detailed information about the CPU architecture and characteristics. Open a terminal and type:

```shell
$ lscpu
```

This command will display information such as CPU model, CPU family, number of cores and threads, clock speed, and cache size. The <span class="highlight--red">lscpu</span> command output is easy to read and provides a concise overview of the CPU's specifications.

#### Using cat /proc/cpuinfo

The <span class="highlight--red">/proc/cpuinfo</span> file contains information about the CPU and its features. Open a terminal and run:

<div class="code-box_snippetContainer__cJ6zK"></div>```console
$ cat /proc/cpuinfo
```

This command will display detailed information about each CPU core, including model name, vendor, cache size, and flags indicating CPU-supported features. The output can be quite extensive, as it provides information for each core on the system.

#### Using top or htop Command

The <span class="highlight--red">top</span> and <span class="highlight--red">htop</span> commands are system monitoring tools that provide real-time information about processes and system resources. Open a terminal and type:

```console
$ top
```

or

```console
$ htop
```

Look for the CPU section, which displays CPU usage, load average, and individual core usage information. While these commands primarily focus on process monitoring, they glance at CPU utilization and core performance.

#### Using nproc Command

The <span class="highlight--red">nproc</span> command displays the number of processing units available. Open a terminal and run:

```console
$ nproc
```

This command will output the total number of CPU cores. It provides a simple way to determine the number of cores without diving into detailed specifications.

#### Using hardinfo Command

The <span class="highlight--red">hardinfo</span> command is a graphical tool that provides detailed information about hardware components, including the CPU. Install it if it's not already available and run:

```console
$ hardinfo
```

Navigate to the "Processor" section to view CPU-related information. And click generate report. Hardinfo offers a user-friendly interface and presents CPU details in an organized manner.

![hardinfo command output](https://www.scaler.com/topics/images/hardinfo-command-output.webp)

![hardinfo system summary](https://www.scaler.com/topics/images/hardinfo-system-summary.webp)

#### Using hwinfo Command

The <span class="highlight--red">hwinfo</span> command is a powerful hardware information tool. Install it if needed and execute:

```console
$ hwinfo --cpu
```

This command will provide comprehensive information about the CPU, including architecture, clock speed, cache size, and supported features. The output may contain a wealth of information, making it suitable for advanced users and system administrators.

#### Using dmidecode -t Processor Command

The <span class="highlight--red">dmidecode</span> command displays information from the system DMI (Desktop Management Interface) table. Open a terminal and run:

```console
$ sudo dmidecode -t processor
```

This command will output detailed information about the CPU, such as socket designation, type, family, and characteristics. The <span class="highlight--red">dmidecode</span> command extracts information directly from the system's firmware, providing accurate and specific details about the CPU.

#### Using getconf \_NPROCESSORS\_ONLN Command

The <span class="highlight--red">getconf</span> command retrieves system configuration variables. Open a terminal and type:

```shell
$ getconf _NPROCESSORS_ONLN
```

This command will display the number of online processors or CPU cores. It is a quick way to obtain the core count without requiring extensive CPU information.

#### Using Inxi Tool

The <span class="highlight--red">inxi</span> tool provides a comprehensive system information overview, including CPU details. Install it if necessary and run:

```console
$ inxi -C
```

This command will display CPU-related information, including model, cache size, clock speed, and other relevant details. Inxi is a versatile tool that offers a wide range of system information, making it useful for various purposes.

#### Using lshw Tool

The <span class="highlight--red">lshw</span> command (Hardware Lister) provides detailed information about the system's hardware configuration. Install it if not already available and execute:

```shell
$ sudo lshw -class processor
```

This command will show detailed information about the processor, including model, vendor, capabilities, clock speed, and more. Lshw generates a comprehensive report that includes various hardware components, making it a valuable tool for system inspection.

Here are some other methods to get Linux CPU info:

**1. Using the cpufrequtils Command:**

The <span class="highlight--red">cpufrequtils</span> package provides utilities for managing CPU frequency scaling. Install it if needed and run:

```console
$ cpufreq-info
```

This command will display information about the current CPU frequency scaling settings, including the available scaling governors and the maximum and minimum CPU frequencies.

**2. Using the sysfs Filesystem:**

Linux provides a sysfs filesystem that exposes information about the system's devices and drivers. Open a terminal and navigate to the <span class="highlight--red">"/sys/devices/system/cpu"</span> directory. Inside this directory, you will find subdirectories corresponding to each CPU core. You can access files such as "cpu MHz" to retrieve the current CPU frequency, "cache" to obtain cache-related information, and <span class="highlight--red">"cpuinfo\_max\_freq"</span> to determine the maximum CPU frequency.

**3. Using the dmidecode -t 4 Command:**

The <span class="highlight--red">dmidecode</span> command can also provide information about the CPU sockets available on the system. Open a terminal and run:

```console
$ sudo dmidecode -t 4
```

This command will display information about the physical characteristics of the CPU sockets, including socket designation, type, and more.

**4. Using the i7z Tool:**

The <span class="highlight--red">i7z</span> tool is designed for Intel Core i3/i5/i7 CPUs and provides detailed information about their features and status. Install it if necessary and run:

```console
$ i7z
```

This command will display CPU temperature, multiplier, core frequency, and more information.

**5. Using the sysctl Command:**

The <span class="highlight--red">sysctl</span> command allows you to view and modify kernel parameters. Open a terminal and run:

```console
$ sysctl -a | grep machdep.cpu
```

This command will display CPU-related kernel parameters, including features, capabilities, and cache information.

Utilizing these methods lets you easily retrieve CPU information on your Linux system. Each command or tool provides different levels of detail, allowing you to choose the one that best suits your needs. Understanding your CPU's capabilities and specifications can be beneficial for system optimization, troubleshooting, or hardware compatibility purposes.

Whether you prefer a command-line approach or a graphical tool, Linux offers a variety of options to obtain CPU information. These versatile methods cater to different user preferences, making gathering the necessary information for your specific requirements easier.

Checking CPU information on Linux is crucial for understanding your system's hardware configuration and capabilities. By using various commands and tools such as <span class="highlight--red">lscpu</span>, <span class="highlight--red">cat /proc/cpuinfo</span>, <span class="highlight--red">top</span>, <span class="highlight--red">htop</span>, <span class="highlight--red">nproc</span>, <span class="highlight--red">hardinfo</span>, <span class="highlight--red">hwinfo</span>, <span class="highlight--red">dmidecode</span>, <span class="highlight--red">getconf</span>, <span class="highlight--red">inxi</span>, <span class="highlight--red">lshw</span>, and more, you can gather detailed information about your CPU, including its model, architecture, clock speed, cache size, and supported features. This knowledge is valuable for system optimization, troubleshooting, resource allocation, and software development. Choose the method that suits your needs and explore the capabilities of your CPU on Linux.

</section><section class="summary">#### Conclusion

- Checking CPU information on Linux is crucial for understanding your system's hardware configuration and capabilities.
- The <span class="highlight--red">lscpu</span> command provides a concise overview of CPU specifications, including the model, family, clock speed, and cache size.
- The <span class="highlight--red">cat /proc/cpuinfo</span> command offers detailed information about each CPU core, such as the model name, vendor, cache size, and supported features.
- The <span class="highlight--red">top</span> and <span class="highlight--red">htop</span> commands provide real-time CPU utilization, load average, and core usage information.
- The <span class="highlight--red">nproc</span> command quickly determines the total number of CPU cores without extensive specifications.
- Tools like <span class="highlight--red">hardinfo</span>, <span class="highlight--red">hwinfo</span>, <span class="highlight--red">dmidecode</span>, <span class="highlight--red">getconf</span>, <span class="highlight--red">inxi</span>, and <span class="highlight--red">lshw</span> provide comprehensive reports on CPU and system information.
- The <span class="highlight--red">cpufrequtils</span> package allows the management of CPU frequency scaling settings.
- The sysfs filesystem provides access to CPU-related information, including current frequency and cache details.
- The **i7z tool** is designed for <span class="highlight--red">Intel Core i3/i5/i7</span> CPUs and provides detailed information about their features and status.
- The <span class="highlight--red">sysctl</span> command lets you view and modify kernel parameters related to CPU information.
- Utilizing these methods and tools allows you to gather detailed CPU information for system optimization, troubleshooting, and software development purposes.

</section></div>

# How to Check CPU Temperature on Linux

Link: [https://phoenixnap.com/kb/linux-cpu-temp](https://phoenixnap.com/kb/linux-cpu-temp)

<section class="ct-section single-post-header" id="bkmrk-"><div class="ct-section-inner-wrap"><div class="ct-div-block" id="bkmrk--1"><div class="ct-div-block" id="bkmrk--2"></div></div></div></section><section class="ct-section" id="bkmrk-introduction-like-an">#### **Introduction**

Like any electrical component, [CPUs](https://phoenixnap.com/glossary/cpu-definition) generate heat when being used. Some resource-demanding programs cause the CPU to increase the clock speed, which results in higher temperatures. Dust buildup also causes the CPU to overheat.

High temperatures shorten the lifespan of sensitive components, so keeping track of CPU temperatures is crucial. This way, you prevent performance throttling or component damage.

**In this tutorial, you will learn how to use different tools and in-built utilities to check CPU temperature on Linux machines.**

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div class="wp-block-image"></div></div></div></div></div>#### **Prerequisites**

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div>- A machine running Linux
- An account with sudo/root privileges

</div></div></div></div></div>#### Check CPU Temperature Using Lm-Sensors

**Lm-sensors** is a command-line utility for [hardware](https://phoenixnap.com/glossary/what-is-hardware) monitoring. Use the tool to check the temperature of the CPU and other components. Follow these steps to install and configure Lm-sensors:

1\. Open the terminal and install these packages using a package manager for your distribution. In Ubuntu, use the following command:

```
```
sudo apt install hddtemp lm-sensors
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

Wait for the **lm-sensors** and **hddtemp** to finish downloading and installing.

2\. Execute the **`sensors`** command to see the CPU temperature. The output shows the current temperature readings of all sensors in the machine. The results include the temperature of each core and maximum thresholds.

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Sensors command output on Linux Ubuntu.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/sensors.png)</figure></div></div></div></div></div></div>3\. To check SSD and hard drive temperatures, execute the following command:

```
```
sudo hddtemp /dev/sda
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Check hard drive temperature on Linux Ubuntu.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/hddtemp.png)</figure></div></div></div></div></div></div>The output shows the temperature of the selected disk.

4\. To see which system components you can monitor, run **`sudo sensors-detect`**.

Answer **YES** to multiple scanning requests until the system scan is complete.

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Output showing a summary of sensors detected on Ubuntu.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/sensors-detect-output.png)</figure></div></div></div></div></div></div>When the scan completes, the output shows the summary.

5\. To ensure that system monitoring works, load the needed modules using the following command:

```
```
/etc/init.d/kmod start
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Start kmod service on Ubuntu to monitor hardware temperature.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/etc-init.d.png)</figure></div></div></div></div></div></div>6\. To run the **`sensors`** command repeatedly and get real-time data in the terminal, execute the following command:

```
```
watch sensors
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Real-time output in terminal showing CPU temperature on Ubuntu.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/watch-sensors.png)</figure></div></div></div></div></div></div>The output refreshes every two seconds and displays the current CPU temperature reading.

**Note:** To check CPU usage on Linux, read our tutorial on [How to check CPU usage](https://phoenixnap.com/kb/check-cpu-usage-load-linux).

#### Check CPU Temperature Using Psensor

Psensor is a **GUI app** that allows you to monitor the temperature of various system components. This utility also allows you to monitor CPU usage and fan speed.

Psensor includes an [applet](https://phoenixnap.com/glossary/applet) indicator for Ubuntu, allowing you to display the temperature in the top panel to notify you when the temperatures get too high.

##### Install Psensor

Before installing Psensor, you need to install and configure Lm-sensors.

1\. Run this command to install the necessary packages:

```
```
sudo apt install lm-sensors hddtemp
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

2\. Next, scan for sensors in your machine:

```
```
sudo sensors-detect
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

Answer **YES** to any scan requests until the scan is completed.

3\. To make sure the packages are installed, execute the **`sensors`** command.

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Sensors command output on Linux Ubuntu.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/sensors.png)</figure></div></div></div></div></div></div>4\. Update the package repository with **`sudo apt update`**.

5\. Install Psensor using the following command:

```
```
sudo apt install psensor
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Install Psensor app on Ubuntu Linux.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/install-psensor.png)</figure></div></div></div></div></div></div>Answer **YES** and wait for the installation to finish.

### Using Psensor

Search for **Psensor** in the app menu and open the utility. The app displays a graph of the selected values and shows the CPU temperature, CPU and memory usage, free RAM, GPU temperature, and [HDD](https://phoenixnap.com/glossary/what-is-hdd) temperature.

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Psensor app on Ubuntu showing hardware temperatures.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/psensor-graph.png)</figure></div></div></div></div></div></div>To configure Psensor and set which stats you want to see, follow these steps:

1\. Click **Psensor** in the menu bar, followed by **Preferences**.

2\. Check off the boxes for the options you want – whether Psensor launches on system startup, the update interval, graph colors, etc.

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Psensor app Preferences on Ubuntu Linux. ](https://phoenixnap.com/kb/wp-content/uploads/2021/04/psensor-preferences.png)</figure></div></div></div></div></div></div>3\. To show CPU or HDD temperatures in the top panel, go to **Sensor Preferences** under the **Application Indicator.** Enable the **Display sensor in the label** option.

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Display sensor output in the top label in Ubuntu.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/sensor-preferences-1.png)</figure></div><div class="notice-note"><div class="note-icon-wrapper">  
</div><div class="notice-text">  
</div></div></div></div></div></div></div>**Note:** Learn more about monitoring CPU performance by referring to our article on [Linux perf](https://phoenixnap.com/kb/linux-perf), a lightweight command-line utility.

#### Check Temperature Without Third-Party Utilities

There is a way to use the in-built utilities to check the CPU temperature if you don’t want to use third-party apps.

1\. To check the CPU temperature without installing a third-party app, use the following command:

```
```
cat /sys/class/thermal/thermal_zone*/temp
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Display CPU temperature in Ubuntu without third-party apps.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/cat-sys-class.png)</figure></div></div></div></div></div></div>The output shows the CPU temperature in the five-digit format. Here, 49000 means 49C.

2\. If you get several thermal zones and different temperatures, execute the following command to see what a single thermal zone represents:

```
```
cat /sys/class/thermal/<thermal_zoneNumber>/type
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

For example, run **`cat /sys/class/thermal/thermal_zone2/type`** to see the type of thermal zone 2.

The CPU temperature is in the zone labeled **x86\_pkg\_temp**.

3\. To see what all the thermal zones are referring to, use:

```
```
paste <(cat /sys/class/thermal/thermal_zone*/type) <(cat /sys/class/thermal/thermal_zone*/temp) | column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/'
```<button class="copy-the-code-button" data-style="svg-icon" title="Copy to Clipboard"><svg aria-hidden="true" class="copy-icon" fill="currentColor" focusable="false" height="16" role="img" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></button>
```

<div class="ct-section-inner-wrap"><div class="ct-new-columns"><div class="ct-div-block"><div class="ct-text-block single-post-content"><div><div class="wp-block-image"><figure class="aligncenter">![Display CPU temperature in Ubuntu without third-party apps.](https://phoenixnap.com/kb/wp-content/uploads/2021/04/paste-cat.png)</figure></div></div></div></div></div></div>The output shows the last stored temperature for that thermal zone in degrees Celsius. In this example, there is only one thermal zone, labeled **x86\_pkg\_temp**, which represents the CPU temperature.

Conclusion

You now know how to check CPU temperature on Linux using various utilities. The guide also showed how to configure the tools to display other information, such as GPU and HDD temperature.

<div class="ct-section-inner-wrap"><div class="ct-new-columns" id="bkmrk-next-you-should-read"><div class="ct-div-block" id="bkmrk-next-you-should-read-1"><div class="ct-text-block single-post-content" id="bkmrk--3"><div id="bkmrk--4"></div><div data-post-id="114827" data-thank-text="Thank you for your feedback!" id="bkmrk--5"></div></div><div class="ct-shortcode" id="bkmrk--6"><div class="scriptlesssocialsharing"></div></div><div class="ct-div-block" id="bkmrk--7"><div class="ct-div-block" id="bkmrk--8"><div class="ct-text-block" id="bkmrk--9"></div></div></div><div class="ct-div-block" id="bkmrk-next-you-should-read-2"><div class="ct-text-block" id="bkmrk-next-you-should-read-3">**Next you should read**</div><div class="ct-div-block" id="bkmrk-bare-metal-servers%C2%A0s"><div class="ct-div-block" id="bkmrk-bare-metal-servers%C2%A0s-1"><div class="ct-code-block" id="bkmrk-bare-metal-servers%C2%A0s-2"><div class="single-related-post"><div class="srp-categories">[Bare Metal Servers](https://phoenixnap.com/kb/category/bare-metal-servers) [SysAdmin](https://phoenixnap.com/kb/category/sysadmin)</div>[How to Install IPMItool on Centos 7/8 &amp; Ubuntu 18.04/20.04](https://phoenixnap.com/kb/install-ipmitool-ubuntu-centos)<div class="srp-date">August 27, 2020</div>---

<div class="srp-excerpt">**This article helps you install IPMItool on your CentOS or Ubuntu system. Download, install and enable...**</div>[READ MORE](https://phoenixnap.com/kb/install-ipmitool-ubuntu-centos)</div></div></div><div class="ct-div-block" id="bkmrk-devops-and-developme"><div class="ct-code-block" id="bkmrk-devops-and-developme-1"><div class="single-related-post"><div class="srp-categories">[DevOps and Development](https://phoenixnap.com/kb/category/devops-and-development) [Virtualization](https://phoenixnap.com/kb/category/virtualization)</div>[How to Set Docker Memory and CPU Usage Limit](https://phoenixnap.com/kb/docker-memory-and-cpu-limit)<div class="srp-date">December 6, 2023</div>---

<div class="srp-excerpt">**Docker containers have unlimited access to RAM and CPU memory of the host. This is not the recommended...**</div>[READ MORE](https://phoenixnap.com/kb/docker-memory-and-cpu-limit)</div></div></div><div class="ct-div-block" id="bkmrk-sysadmin%C2%A0web-servers"><div class="ct-code-block" id="bkmrk-sysadmin%C2%A0web-servers-1"><div class="single-related-post"><div class="srp-categories">[SysAdmin](https://phoenixnap.com/kb/category/sysadmin) [Web Servers](https://phoenixnap.com/kb/category/web-servers)</div>[How to Check Memory Usage in Linux, 5 Simple Commands](https://phoenixnap.com/kb/linux-commands-check-memory-usage)<div class="srp-date">March 28, 2024</div>---

<div class="srp-excerpt">**In this tutorial, learn the five most commonly used commands to check memory usage in Linux...**</div>[READ MORE](https://phoenixnap.com/kb/linux-commands-check-memory-usage)</div></div></div><div class="ct-div-block" id="bkmrk-sysadmin%C2%A0web-servers-2"><div class="ct-code-block" id="bkmrk-sysadmin%C2%A0web-servers-3"><div class="single-related-post"><div class="srp-categories">[SysAdmin](https://phoenixnap.com/kb/category/sysadmin) [Web Servers](https://phoenixnap.com/kb/category/web-servers)</div>[How to Check CPU Utilization in Linux with Command Line](https://phoenixnap.com/kb/check-cpu-usage-load-linux)<div class="srp-date">March 6, 2024</div></div></div></div></div></div></div></div></div></section>

# Comandos IPMITOOL

Link: [https://wiki.joeplaa.com/applications#ipmitool](https://wiki.joeplaa.com/applications#ipmitool)

## Installation

```shellsession
apt update && apt install ipmitool
```

## Configuration

Create a user with ipmi permissions only in Dell iDrac or HP iLO

## Commands

> [https://www.tzulo.com/crm/knowledgebase/47/IPMI-and-IPMITOOL-Cheat-sheet.html](https://www.tzulo.com/crm/knowledgebase/47/IPMI-and-IPMITOOL-Cheat-sheet.html)

### Get all sensor data

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr list full
```

### Get temperature(s)

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr type Temperature
```

### Get fanspeed(s)

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr type Fan
```

Or

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr get Fan1 Fan2 | grep "Sensor Reading"
```

### Get power supply info

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> sdr type 'Power Supply'
```

### Enable auto fan control / disable static mode (Dell)

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x01 0x01
```

### Enable static fan control / disable auto mode (Dell)

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x01 0x00
```

### Set fanspeed 20% (Dell)

See the script for other speeds. The last 4 characters differ.

```shellsession
ipmitool -I lanplus -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> raw 0x30 0x30 0x02 0xff 0x14
```

### Change system state

```shellsession
ipmitool -H <iDRAC IP> -U <iDRAC user> -P <iDRAC password> chassis power <status|on|off|cycle|reset>
```

<div class="code-toolbar" id="bkmrk-"><div class="toolbar"><div class="toolbar-item">  
</div></div></div>

# Recommended operating range for Core temperature

Link: [https://forums.tomshardware.com/threads/what-happens-if-cpu-temp-hits-90%C2%B0c-or-more.3028572/#post-18951574](https://forums.tomshardware.com/threads/what-happens-if-cpu-temp-hits-90%C2%B0c-or-more.3028572/#post-18951574)

Coolers with 92mm fans are low-end to mid-range, which may be somewhat inadequate, since your processor's Thermal Design Power (TDP) is 120 Watts.  
  
What is your ambient temperature? Normal or "Standard" room temperature is 22°C or 72°F, so high ambient temperature will adversely affect Core temperatures.  
  
Although your Xeon X5460 has Thermal Specifications of Tcase 63°C and Tj Max 100°C, Tcase is *not* the limiting Thermal Specification; Tj Max *is*, which is the temperature that your processor will "Throttle" or reduce Core speed to prevent thermal damage.  
  
Tcase is a misleading Specification because it's a *factory only* measurements on the surface of the Integrated Heat Spreader, so Tcase is *not* Core temperature, which is considerably higher. Further, Tcase is only relevant to the stock cooler.  
  
Although 90°C Core temperature isn't quite hot enough to cause Throttling, it’s not advisable to push your CPU to the thermal limit, just as you wouldn't operate a vehicle with the temperature gauge pegged in the red “hot” zone.  
  
If your hottest Core is within a few degrees of Throttle temperature, your CPU is already too hot. The consensus among highly experienced and well informed system builders and overclockers, is that cooler is better for ultimate stability, performance and longevity.  
  
As such, all agree it's wise to observe a reasonable thermal limit below Tj Max. So regardless of your rig's environmental conditions, system configuration, workloads or any other variables, *<u>sustained</u>* Core temperatures above 80°C aren't recommended.  
  
Here's the recommended operating range for Core temperature:  
  
**80°C** **Hot** (100% Load)  
**75°C** **Warm**  
**70°C** **Warm** (Heavy Load)  
**60°C** **Norm**  
**50°C** **Norm** (Medium Load)  
**40°C** **Norm**  
**30°C** **Cool** (Idle)  
  
Also, you might want to read this Sticky: **Intel Temperature Guide** - [http://www.tomshardware.com/forum/id-1800828/intel-temperature-guide.html](http://www.tomshardware.com/forum/id-1800828/intel-temperature-guide.html)

# O comando HTOP no Linux

Link: [https://blog.ironlinux.com.br/o-comando-htop-no-linux/](https://blog.ironlinux.com.br/o-comando-htop-no-linux/)

- 17 de maio de 2022

Está com o seu servidor Linux lento e precisa de comandos para ajudar a descobrir o motivo? O comando htop pode ser um grande aliado na análise de processos e recursos.

O comando **HTOP** é um utilitário de linha de comando que tem como objetivo auxiliar o usuário a monitorar de forma interativa e em tempo real os recursos de seu sistema operacional Linux.

## 1| Instalar htop no Ubuntu

<div class="content mb-10" id="bkmrk-copiar" style="text-align: justify;"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
sudo apt install htop

```

## 2| Instalar htop no CentOS

<div class="content mb-10" id="bkmrk-copiar-1" style="text-align: justify;"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
sudo yum install htop

```

## 3| Iniciar a ferramenta

<div class="content mb-10" id="bkmrk-copiar-2" style="text-align: justify;"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
htop

```

## 4| Visão geral da ferramenta

Ao digitar htop é apresentado a tela abaixo:

<div class="content mb-10" id="bkmrk-" style="text-align: justify;">[![HTOP Linux](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop1_hub08cc9492934db860bce85724b14ff4c_167855_1110x555_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop1.png)</div>## 5| Explicando os blocos

### Bloco superior

<div class="content mb-10" id="bkmrk--1" style="text-align: justify;">[![Explicando bloco superior do htop](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop_imagem1_hu48f19580edc8a08fe93137902397e967_185655_2000x788_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop_imagem1.png)</div>### Bloco Inferior

<div class="content mb-10" id="bkmrk--2" style="text-align: justify;">[![Explicando bloco inferior do htop](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop3_hud46972117cfe5a7f8797a6709eada205_169753_1114x493_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop3.png)</div>### Descrição dos Campos

<div class="content mb-10" id="bkmrk-campo-descri%C3%A7%C3%A3o-pid-" style="text-align: justify;"><table><thead><tr><th>Campo</th><th>Descrição</th></tr></thead><tbody><tr><td>PID</td><td>ID do processo</td></tr><tr><td>USER</td><td>Dono do processo</td></tr><tr><td>PRI</td><td>Prioridade do processo (Varia de 0 a 139, sendo que quanto menor mais prioridade)</td></tr><tr><td>NI</td><td>“Nices Values” afeta o valor da prioridade do processo (Varia de -20 a 19)</td></tr><tr><td>VIRT</td><td>Total de memória requerida pelo processo (não necessariamente está toda em uso)</td></tr><tr><td>RES</td><td>Quantidade de memória RAM que o processo está utilizando</td></tr><tr><td>SHR</td><td>Total de memória Compartilhada usada pelo processo</td></tr><tr><td>S</td><td>Estado atual do processo</td></tr><tr><td>CPU %</td><td>Percentual de tempo de CPU que o processo está utilizando</td></tr><tr><td>MEM %</td><td>Percentual de Memória RAM que o processo está utilizando</td></tr><tr><td>TIME +</td><td>Tempo de processador que o processo está utilizando</td></tr><tr><td>COMMAND</td><td>Comando que iniciou o processo</td></tr></tbody></table>

</div>## 5| Opções via CommandLine

O htop permite que você passe opções/ argumentos na execução dele para ajudar na análise

## 5.1| Delay

O comando htop muda as informações apresentadas rapidamente, pois os processos estão constatemente sendo atualizados. Com o comando abaixo o resultado é atualizado com o Delay (atraso) que você definir:

<div class="content mb-10" id="bkmrk-copiar-3" style="text-align: justify;"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
htop -d 15

```

O argumento acima tem o delay de 1 segundo, pois é calculado em décimo de segundo.

### 5.2| Filtro com PID

É possível filtrar com um determinado PID e exibir as informações deles

<div class="content mb-10" id="bkmrk-copiar-4" style="text-align: justify;"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
htop -p 1,19296

```

<div class="content mb-10" id="bkmrk--3" style="text-align: justify;"><div class="highlight"></div>[![Filtrar PID no HTOP](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop10_hu3d0b9e2b72c74fd983fb62cf31802e02_53084_1052x573_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/05/htop10.png)</div>## Conclusão

Assim como o gerenciador de tarefas no Windows, o comando htop é realmente muito poderoso e com certeza irá lhe ajudar na análise de qualquer caso.

Por fim, agradecemos a leitura e esperamos que este post tenha te ajudado de alguma maneira! Caso tenha alguma dúvida, entre em contato conosco pelo [Telegram](https://t.me/ironlinux) , [Facebook](https://www.facebook.com/ironlinuxoficial) ou [Instagram](https://www.instagram.com/ironlinux_/) ! Veja mais posts no [IronLinux](https://blog.ironlinux.com.br/) !

# CTOP para verificação de uso de containers Docker

sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop  
sudo chmod +x /usr/local/bin/ctop

# Dicas Linux

Dicas para Linux

# Como descobrir (listar) o UUID e LABEL de todas as partições?

Link: [https://bistrunka.net/2012/09/22/como-descobrir-listar-o-uuid-e-label-de-todas-as-particoes/](https://bistrunka.net/2012/09/22/como-descobrir-listar-o-uuid-e-label-de-todas-as-particoes/)

 ( How to find out (list) the UUID and LABEL all the partitions? )

Para listar o código UUID (universally unique identifier) e LABEL (rótulo/nome) de todas as partições de todos os discos do computador com um único comando basta utilizar, como root, o comando blkid:

**sudo blkid**

Olhe a saída no meu computador:

**zumm@destino:~$ sudo blkid**  
/dev/sda1: LABEL=”Ubuntu-12.10″ UUID=”98e6d91d-9b8b-46e5-8429-e492044cbbd5″ TYPE=”ext4″  
/dev/sda2: LABEL=”Vídeos” UUID=”457fce87-b36d-4364-971a-afaa11e39357″ TYPE=”ext4″  
/dev/sda3: LABEL=”Backup” UUID=”ae9f9aeb-ae10-4e70-b680-396e0dd1c320″ TYPE=”ext4″  
/dev/sda5: UUID=”c526a707-a8bb-431a-a2ea-398bb59f8146″ TYPE=”swap”  
/dev/sda6: LABEL=”AMD64″ UUID=”a1d9c813-b4e7-4331-b4eb-6a08e44938e8″ TYPE=”ext4″  
/dev/sda7: LABEL=”Gentoo” UUID=”9daf9b72-ec06-4175-b484-01ff1add6a37″ TYPE=”ext4″  
/dev/sda8: LABEL=”Mint” UUID=”417d751e-faf9-4abc-ac43-271d47c973c6″ TYPE=”ext4″  
/dev/sdb1: LABEL=”Ubuntu-11.04″ UUID=”0a3b9f72-bbd6-4e7f-bf11-6ef2043cf973″ TYPE=”ext4″  
/dev/sdb2: LABEL=”Dados” UUID=”9100787c-03bf-4e22-8080-bd9a586fa2fe” TYPE=”ext3″  
/dev/sdb3: LABEL=”Músicas” UUID=”4d759fd5-5ab2-4b92-b6b6-c015507672ce” TYPE=”ext3″  
/dev/sdb4: UUID=”bdf9c723-c739-4e53-8810-a4e98c9ea8f5″ TYPE=”swap”  
/dev/sdc1: LABEL=”Debian” UUID=”09aefbca-ddea-4068-be78-380fd959c658″ TYPE=”ext4″  
/dev/sdc2: LABEL=”Arch” UUID=”1e2b868a-c634-4f3b-81b6-0e22e33552b3″ TYPE=”ext4″  
/dev/sdc5: UUID=”d6609dbc-1720-4e3d-b316-730fcd87d6b4″ TYPE=”swap”  
/dev/sdc6: LABEL=”Music” UUID=”414d9df7-1cdd-47e5-bda3-523b0a1f0a53″ TYPE=”ext4″  
/dev/sdc7: LABEL=”Video” UUID=”356f8f81-8569-46ef-9fbe-fd8837bb6538″ TYPE=”ext4″

## Outros comandos:

### Para listar o UUID:

**zumm@destino:~$ ls -l /dev/disk/by-uuid**

total 0  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 0a3b9f72-bbd6-4e7f-bf11-6ef2043cf973 -&gt; ../../sdb1  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 417d751e-faf9-4abc-ac43-271d47c973c6 -&gt; ../../sda8  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 457fce87-b36d-4364-971a-afaa11e39357 -&gt; ../../sda2  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 4d759fd5-5ab2-4b92-b6b6-c015507672ce -&gt; ../../sdb3  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 9100787c-03bf-4e22-8080-bd9a586fa2fe -&gt; ../../sdb2  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 98e6d91d-9b8b-46e5-8429-e492044cbbd5 -&gt; ../../sda1  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 9daf9b72-ec06-4175-b484-01ff1add6a37 -&gt; ../../sda7  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 a1d9c813-b4e7-4331-b4eb-6a08e44938e8 -&gt; ../../sda6  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 ae9f9aeb-ae10-4e70-b680-396e0dd1c320 -&gt; ../../sda3  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 bdf9c723-c739-4e53-8810-a4e98c9ea8f5 -&gt; ../../sdb4  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 c526a707-a8bb-431a-a2ea-398bb59f8146 -&gt; ../../sda5

### Para listar o LABEL:

**zumm@destino:~$ ls -l /dev/disk/by-label**

total 0  
drwxr-xr-x 2 root root 220 2012-09-22 16:37 .  
drwxr-xr-x 6 root root 120 2012-09-21 20:05 ..  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 AMD64 -&gt; ../../sda6  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 Backup -&gt; ../../sda3  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 Dados -&gt; ../../sdb2  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 Livre -&gt; ../../sda7  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 Mint -&gt; ../../sda8  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 Músicas -&gt; ../../sdb3  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 Ubuntu-11.04 -&gt; ../../sdb1  
lrwxrwxrwx 1 root root 10 2012-09-21 20:05 Ubuntu-12.10 -&gt; ../../sda1  
lrwxrwxrwx 1 root root 10 2012-09-21 20:06 Vídeos -&gt; ../../sda2

### Listando os UUID’s de apenas um disco:

**zumm@destino:~$ blkid /dev/sda\[1-9\]**  
/dev/sda1: LABEL=”Ubuntu-12.10″ UUID=”98e6d91d-9b8b-46e5-8429-e492044cbbd5″ TYPE=”ext4″  
/dev/sda2: LABEL=”Vídeos” UUID=”457fce87-b36d-4364-971a-afaa11e39357″ TYPE=”ext4″  
/dev/sda3: LABEL=”Backup” UUID=”ae9f9aeb-ae10-4e70-b680-396e0dd1c320″ TYPE=”ext4″  
/dev/sda5: UUID=”c526a707-a8bb-431a-a2ea-398bb59f8146″ TYPE=”swap”  
/dev/sda6: LABEL=”AMD64″ UUID=”a1d9c813-b4e7-4331-b4eb-6a08e44938e8″ TYPE=”ext4″  
/dev/sda7: LABEL=”Gentoo” UUID=”9daf9b72-ec06-4175-b484-01ff1add6a37″ TYPE=”ext4″  
/dev/sda8: LABEL=”Mint” UUID=”417d751e-faf9-4abc-ac43-271d47c973c6″ TYPE=”ext4″

### Listando organizado por colunas

<div id="bkmrk-" style="text-align: justify;"><div id="bkmrk--1"></div></div>**zumm@destino:~$ sudo blkid -o list -c /dev/null**

### Obtendo todas as informações de uma partição com o TUNE2FS

**zumm@destino:~$ sudo tune2fs /dev/sda2**

tune2fs 1.41.14 (22-Dec-2010)  
Filesystem volume name: Vídeos  
Last mounted on: /media/Vídeos  
Filesystem UUID: 457fce87-b36d-4364-971a-afaa11e39357  
Filesystem magic number: 0xEF53  
Filesystem revision #: 1 (dynamic)  
Filesystem features: has\_journal ext\_attr resize\_inode dir\_index filetype needs\_recovery extent flex\_bg sparse\_super large\_file huge\_file uninit\_bg dir\_nlink extra\_isize  
Filesystem flags: signed\_directory\_hash  
Default mount options: (none)  
Filesystem state: clean  
Errors behavior: Continue  
Filesystem OS type: Linux  
Inode count: 59375616  
Block count: 237497855  
Reserved block count: 11874892  
Free blocks: 175586011  
Free inodes: 59374910  
First block: 0  
Block size: 4096  
Fragment size: 4096  
Reserved GDT blocks: 967  
Blocks per group: 32768  
Fragments per group: 32768  
Inodes per group: 8192  
Inode blocks per group: 512  
RAID stride: 32750  
Flex block group size: 16  
Filesystem created: Tue Nov 1 00:13:51 2011  
Last mount time: Fri Sep 21 20:06:02 2012  
Last write time: Fri Sep 21 20:06:02 2012  
Mount count: 16  
Maximum mount count: 32  
Last checked: Mon Sep 17 08:18:46 2012  
Check interval: 15552000 (6 months)  
Next check after: Sat Mar 16 08:18:46 2013  
Lifetime writes: 251 GB  
Reserved blocks uid: 0 (user root)  
Reserved blocks gid: 0 (group root)  
First inode: 11  
Inode size: 256  
Required extra isize: 28  
Desired extra isize: 28  
Journal inode: 8  
Default directory hash: half\_md4  
Directory Hash Seed: d714b716-999e-4eb1-b4b8-a27ae6964d3b  
Journal backup: inode blocks  
**zumm@destino:~$**

Já dá para brincar um pouquinho.

# Introduction to fstab

Link: [https://help.ubuntu.com/community/Fstab](https://help.ubuntu.com/community/Fstab)

The configuration file <tt>/etc/fstab</tt> contains the necessary information to automate the process of mounting partitions. In a nutshell, mounting is the process where a raw (physical) partition is prepared for access and assigned a location on the file system tree (or mount point).<span class="anchor" id="bkmrk-"></span><span class="anchor" id="bkmrk--1"></span>

- In general fstab is used for internal devices, CD/DVD devices, and network shares (samba/nfs/sshfs). Removable devices such as flash drives \*can\* be added to fstab, but are typically mounted by gnome-volume-manager and are beyond the scope of this document.<span class="anchor" id="bkmrk--2"></span><span class="anchor" id="bkmrk--3"></span>
- Options for mount and fstab are similar.<span class="anchor" id="bkmrk--4"></span>
- Partitions listed in fstab can be configured to automatically mount during the boot process.<span class="anchor" id="bkmrk--5"></span>
- If a device/partition is not listed in fstab ONLY ROOT may mount the device/partition.<span class="anchor" id="bkmrk--6"></span>
- Users may mount a device/partition if the device is in fstab with the proper options.<span class="anchor" id="bkmrk--7"></span><span class="anchor" id="bkmrk--8"></span><span class="anchor" id="bkmrk--9"></span>

![IconsPage/tip.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=tip.png "IconsPage/tip.png") For usage with network shares, see [SettingUpNFSHowTo](https://help.ubuntu.com/community/SettingUpNFSHowTo) , [SettingUpSamba](https://help.ubuntu.com/community/SettingUpSamba) and [SSHFS](http://www.debuntu.org/2006/04/27/39-mounting-a-fuse-filesystem-form-etcfstab).<span class="anchor" id="bkmrk--10"></span><span class="anchor" id="bkmrk--11"></span>

# Fstab File Configuration

<span class="anchor" id="bkmrk--13"></span><span class="anchor" id="bkmrk--14"></span>

![IconsPage/info.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=info.png "IconsPage/info.png") The syntax of a fstab entry is :<span class="anchor" id="bkmrk--15"></span><span class="anchor" id="bkmrk--16"></span><span class="anchor" id="bkmrk--17"></span>

```
[Device] [Mount Point] [File System Type] [Options] [Dump] [Pass]
```

<span class="anchor" id="bkmrk--19"></span><span class="anchor" id="bkmrk--20"></span>

<div id="bkmrk-fields-description-%3C" style="text-align: justify;"><table style="width: 99.9986%;"><tbody><tr><td style="width: 17.1518%;">**fields**

</td><td style="width: 82.8173%;">**description**

</td></tr><tr><td style="width: 17.1518%;"><span class="anchor" id="bkmrk--21"></span>&lt;device&gt;

</td><td style="width: 82.8173%;">The device/partition (by /dev location or UUID) that contain a file system.

</td></tr><tr><td style="width: 17.1518%;"><span class="anchor" id="bkmrk--22"></span>&lt;mount point&gt;

</td><td style="width: 82.8173%;">The directory on your root file system (aka mount point) from which it will be possible to access the content of the device/partition (note: swap has no mount point). Mount points should not have spaces in the names.

</td></tr><tr><td style="width: 17.1518%;"><span class="anchor" id="bkmrk--23"></span>&lt;file system type&gt;

</td><td style="width: 82.8173%;">Type of file system (see [LinuxFilesystemsExplained](https://help.ubuntu.com/community/LinuxFilesystemsExplained)).

</td></tr><tr><td style="width: 17.1518%;"><span class="anchor" id="bkmrk--24"></span>&lt;options&gt;

</td><td style="width: 82.8173%;">Mount options of access to the device/partition (see the man page for <tt>mount</tt>).

</td></tr><tr><td style="width: 17.1518%;"><span class="anchor" id="bkmrk--25"></span>&lt;dump&gt;

</td><td style="width: 82.8173%;">Enable or disable backing up of the device/partition (the command *dump*). This field is usually set to 0, which disables it.

</td></tr><tr><td style="width: 17.1518%;"><span class="anchor" id="bkmrk--26"></span>&lt;pass num&gt;

</td><td style="width: 82.8173%;">Controls the order in which *fsck* checks the device/partition for errors at boot time. The root device should be 1. Other partitions should be 2, or 0 to disable checking.

</td></tr></tbody></table>

</div><span class="anchor" id="bkmrk--28"></span><span class="anchor" id="bkmrk--29"></span>

Please refer to the examples section for sample entries. We have provided you some detailed explanations of each field:<span class="anchor" id="bkmrk--30"></span><span class="anchor" id="bkmrk--31"></span>

## Device

<span class="anchor" id="bkmrk--33"></span><span class="anchor" id="bkmrk--34"></span>

By default, Ubuntu now uses [UUID](http://en.wikipedia.org/wiki/UUID) to identify partitions.<span class="anchor" id="bkmrk--35"></span><span class="anchor" id="bkmrk--36"></span>

UUID=xxx.yyy.zzz<span class="anchor" id="bkmrk--37"></span><span class="anchor" id="bkmrk--38"></span>

To list your devices by UUID use blkid<span class="anchor" id="bkmrk--39"></span><span class="anchor" id="bkmrk--40"></span>

<span class="anchor" id="bkmrk--42"></span><span class="anchor" id="bkmrk--43"></span>

```
sudo blkid
```

<span class="anchor" id="bkmrk--45"></span><span class="anchor" id="bkmrk--46"></span>

Alternative ways to refer to partitions:<span class="anchor" id="bkmrk--47"></span>

- Label : LABEL=label<span class="anchor" id="bkmrk--48"></span>
- Network ID<span class="anchor" id="bkmrk--49"></span>
    - Samba : //server/share<span class="anchor" id="bkmrk--50"></span>
    - NFS : server:/share<span class="anchor" id="bkmrk--51"></span>
    - SSHFS : sshfs#user@server:/share<span class="anchor" id="bkmrk--52"></span>
- Device : /dev/sdxy (not recommended)<span class="anchor" id="bkmrk--53"></span><span class="anchor" id="bkmrk--54"></span>

## Mount point

<span class="anchor" id="bkmrk--56"></span><span class="anchor" id="bkmrk--57"></span>

A mount point is a location on your directory tree to mount the partition. The default location is /media although you may use alternate locations such as /mnt or your home directory.<span class="anchor" id="bkmrk--58"></span><span class="anchor" id="bkmrk--59"></span>

You may use any name you wish for the mount point, but you must create the mount point before you mount the partition.<span class="anchor" id="bkmrk--60"></span><span class="anchor" id="bkmrk--61"></span>

For example : /media/windows<span class="anchor" id="bkmrk--62"></span><span class="anchor" id="bkmrk--63"></span>

<span class="anchor" id="bkmrk--65"></span><span class="anchor" id="bkmrk--66"></span>

```
sudo mkdir /media/windows
```

<span class="anchor" id="bkmrk--68"></span><span class="anchor" id="bkmrk--69"></span>

## File System Type

<span class="anchor" id="bkmrk--71"></span><span class="anchor" id="bkmrk--72"></span>

You may either use auto or specify a file system. Auto will attempt to automatically detect the file system of the target file system and in general works well. In general auto is used for removable devices and a specific file system or network protocol for network shares.<span class="anchor" id="bkmrk--73"></span><span class="anchor" id="bkmrk--74"></span>

Examples:<span class="anchor" id="bkmrk--75"></span>

- auto<span class="anchor" id="bkmrk--76"></span>
- vfat - used for FAT partitions.<span class="anchor" id="bkmrk--77"></span>
- ntfs, ntfs-3g - used for ntfs partitions.<span class="anchor" id="bkmrk--78"></span>
- ext4, ext3, ext2, jfs, reiserfs, etc.<span class="anchor" id="bkmrk--79"></span>
- udf,iso9660 - for CD/DVD.<span class="anchor" id="bkmrk--80"></span>
- swap.<span class="anchor" id="bkmrk--81"></span><span class="anchor" id="bkmrk--82"></span><span class="anchor" id="bkmrk--83"></span>

## Options

<span class="anchor" id="bkmrk--85"></span><span class="anchor" id="bkmrk--86"></span>

Options are dependent on the file system.<span class="anchor" id="bkmrk--87"></span><span class="anchor" id="bkmrk--88"></span>

You may use "defaults" here and some typical options may include :<span class="anchor" id="bkmrk--89"></span><span class="anchor" id="bkmrk--90"></span>

- **Ubuntu 8.04** and later uses **relatime** as default for linux native file systems. You can find a discussion of relatime here : [http://lwn.net/Articles/244829](http://lwn.net/Articles/244829). This relates to when and how often the last access time of the current version of a file is updated, i.e. when it was last read.<span class="anchor" id="bkmrk--91"></span><span class="anchor" id="bkmrk--92"></span>
- defaults = rw, suid, dev, exec, auto, nouser, and async.<span class="anchor" id="bkmrk--93"></span>
- ntfs/vfat = permissions are set at the time of mounting the partition with umask, dmask, and fmask and can not be changed with commands such as chown or chmod.<span class="anchor" id="bkmrk--94"></span>
    - I advise <tt>dmask=027,fmask=137</tt> (using umask=000 will cause all your files to be executable). More permissive options would be <tt>dmask=000,fmask=111</tt>.<span class="anchor" id="bkmrk--95"></span>
- For mounting samba shares you can specify a username and password, or better a **credentials file**. The credentials file contains should be owned by root.root with permissions = 0400 .<span class="anchor" id="bkmrk--96"></span><span class="anchor" id="bkmrk--97"></span>

Common options :<span class="anchor" id="bkmrk--98"></span><span class="anchor" id="bkmrk--99"></span>

- sync/async - All I/O to the file system should be done (a)synchronously.<span class="anchor" id="bkmrk--100"></span>
- auto - The filesystem can be mounted automatically (at bootup, or when mount is passed the -a option). This is really unnecessary as this is the default action of mount -a anyway.<span class="anchor" id="bkmrk--101"></span>
- noauto - The filesystem will NOT be automatically mounted at startup, or when mount passed -a. You must explicitly mount the filesystem.<span class="anchor" id="bkmrk--102"></span>
- dev/nodev - Interpret/Do not interpret character or block special devices on the file system.<span class="anchor" id="bkmrk--103"></span>
- exec / noexec - Permit/Prevent the execution of binaries from the filesystem.<span class="anchor" id="bkmrk--104"></span>
- suid/nosuid - Permit/Block the operation of suid, and sgid bits.<span class="anchor" id="bkmrk--105"></span>
- ro - Mount read-only.<span class="anchor" id="bkmrk--106"></span>
- rw - Mount read-write.<span class="anchor" id="bkmrk--107"></span>
- user - Permit any user to mount the filesystem. This automatically implies noexec, nosuid,nodev unless overridden.<span class="anchor" id="bkmrk--108"></span>
- nouser - Only permit root to mount the filesystem. This is also a default setting.<span class="anchor" id="bkmrk--109"></span>
- defaults - Use default settings. Equivalent to rw, suid, dev, exec, auto, nouser, async.<span class="anchor" id="bkmrk--110"></span>
- \_netdev - this is a network device, mount it after bringing up the network. Only valid with fstype nfs.<span class="anchor" id="bkmrk--111"></span><span class="anchor" id="bkmrk--112"></span>

For specific options with specific file systems see:<span class="anchor" id="bkmrk--113"></span>

- [man mount](http://manpages.ubuntu.com/mount "Manpage")<span class="anchor" id="bkmrk--114"></span><span class="anchor" id="bkmrk--115"></span><span class="anchor" id="bkmrk--116"></span>

## Dump

<span class="anchor" id="bkmrk--118"></span><span class="anchor" id="bkmrk--119"></span>

This field sets whether the backup utility dump will backup file system. If set to "0" file system ignored, "1" file system is backed up.<span class="anchor" id="bkmrk--120"></span><span class="anchor" id="bkmrk--121"></span>

Dump is seldom used and if in doubt use 0.<span class="anchor" id="bkmrk--122"></span><span class="anchor" id="bkmrk--123"></span>

## Pass (fsck order)

<span class="anchor" id="bkmrk--125"></span><span class="anchor" id="bkmrk--126"></span>

Fsck order is to tell fsck what order to check the file systems, if set to "0" file system is ignored.<span class="anchor" id="bkmrk--127"></span><span class="anchor" id="bkmrk--128"></span>

Often a source of confusion, there are only 3 options :<span class="anchor" id="bkmrk--129"></span><span class="anchor" id="bkmrk--130"></span>

- 0 == do not check.<span class="anchor" id="bkmrk--131"></span>
- 1 == check this partition first.<span class="anchor" id="bkmrk--132"></span>
- 2 == check this partition(s) next<span class="anchor" id="bkmrk--133"></span><span class="anchor" id="bkmrk--134"></span>

In practice, use "1" for your root partition, / and 2 for the rest. All partitions marked with a "2" are checked in sequence and you do not need to specify an order.<span class="anchor" id="bkmrk--135"></span><span class="anchor" id="bkmrk--136"></span>

Use "0" to disable checking the file system at boot or for network shares.<span class="anchor" id="bkmrk--137"></span><span class="anchor" id="bkmrk--138"></span>

You may also "tune" or set the frequency of file checks (default is every 30 mounts) but in general these checks are designed to maintain the integrity of your file system and thus you should strongly consider keeping the default settings.<span class="anchor" id="bkmrk--139"></span><span class="anchor" id="bkmrk--140"></span>

# Examples

<span class="anchor" id="bkmrk--142"></span>

![IconsPage/editor.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=editor.png "IconsPage/editor.png") The contents of the file will look similar to following:<span class="anchor" id="bkmrk--143"></span><span class="anchor" id="bkmrk--144"></span><span class="anchor" id="bkmrk--145"></span><span class="anchor" id="bkmrk--146"></span><span class="anchor" id="bkmrk--147"></span><span class="anchor" id="bkmrk--148"></span><span class="anchor" id="bkmrk--149"></span><span class="anchor" id="bkmrk--150"></span><span class="anchor" id="bkmrk--151"></span><span class="anchor" id="bkmrk--152"></span><span class="anchor" id="bkmrk--153"></span><span class="anchor" id="bkmrk--154"></span><span class="anchor" id="bkmrk--155"></span>

```
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

proc  /proc  proc  defaults  0  0
# /dev/sda5
UUID=be35a709-c787-4198-a903-d5fdc80ab2f8  /  ext3  relatime,errors=remount-ro  0  1
# /dev/sda6
UUID=cee15eca-5b2e-48ad-9735-eae5ac14bc90  none  swap  sw  0  0

/dev/scd0  /media/cdrom0  udf,iso9660  user,noauto,exec,utf8  0  0
```

<span class="anchor" id="bkmrk--157"></span><span class="anchor" id="bkmrk--158"></span>

<span class="u">NOTE</span>: These network share examples (samba, nfs, and sshfs) assume you have already set up the appropriate server.<span class="anchor" id="bkmrk--159"></span><span class="anchor" id="bkmrk--160"></span>

<span class="anchor" id="bkmrk--162"></span><span class="anchor" id="bkmrk--163"></span><span class="anchor" id="bkmrk--164"></span><span class="anchor" id="bkmrk--165"></span><span class="anchor" id="bkmrk--166"></span><span class="anchor" id="bkmrk--167"></span><span class="anchor" id="bkmrk--168"></span><span class="anchor" id="bkmrk--169"></span><span class="anchor" id="bkmrk--170"></span><span class="anchor" id="bkmrk--171"></span><span class="anchor" id="bkmrk--172"></span><span class="anchor" id="bkmrk--173"></span><span class="anchor" id="bkmrk--174"></span><span class="anchor" id="bkmrk--175"></span><span class="anchor" id="bkmrk--176"></span><span class="anchor" id="bkmrk--177"></span><span class="anchor" id="bkmrk--178"></span><span class="anchor" id="bkmrk--179"></span><span class="anchor" id="bkmrk--180"></span><span class="anchor" id="bkmrk--181"></span><span class="anchor" id="bkmrk--182"></span><span class="anchor" id="bkmrk--183"></span><span class="anchor" id="bkmrk--184"></span><span class="anchor" id="bkmrk--185"></span><span class="anchor" id="bkmrk--186"></span><span class="anchor" id="bkmrk--187"></span><span class="anchor" id="bkmrk--188"></span><span class="anchor" id="bkmrk--189"></span><span class="anchor" id="bkmrk--190"></span><span class="anchor" id="bkmrk--191"></span><span class="anchor" id="bkmrk--192"></span><span class="anchor" id="bkmrk--193"></span><span class="anchor" id="bkmrk--194"></span><span class="anchor" id="bkmrk--195"></span><span class="anchor" id="bkmrk--196"></span><span class="anchor" id="bkmrk--197"></span><span class="anchor" id="bkmrk--198"></span><span class="anchor" id="bkmrk--199"></span><span class="anchor" id="bkmrk--200"></span>

```
# FAT ~ Linux calls FAT file systems vfat)
# /dev/hda1
UUID=12102C02102CEB83  /media/windows  vfat auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8  0  0

# NTFS ~ Use ntfs-3g for write access (rw) 
# /dev/hda1
UUID=12102C02102CEB83  /media/windows  ntfs-3g  auto,users,uid=1000,gid=100,dmask=027,fmask=137,utf8  0  0

# Zip Drives ~ Linux recognizes ZIP drives as sdx'''4'''

# Separate Home
# /dev/sda7
UUID=413eee0c-61ff-4cb7-a299-89d12b075093  /home  ext3  nodev,nosuid,relatime  0  2

# Data partition
# /dev/sda8
UUID=3f8c5321-7181-40b3-a867-9c04a6cd5f2f  /media/data  ext3  relatime,noexec  0  2

# Samba
//server/share  /media/samba  cifs  user=user,uid=1000,gid=100  0  0
# "Server" = Samba server (by IP or name if you have an entry for the server in your hosts file
# "share" = name of the shared directory
# "user" = your samba user
# This set up will ask for a password when mounting the samba share. If you do not want to enter a password, use a credentials file.
# replace "user=user" with "credentials=/etc/samba/credentials" In the credentials file put two lines
# username=user
# password=password
# make the file owned by root and ro by root (sudo chown root.root /etc/samba/credentials && sudo chmod 400 /etc/samba/credentials)

# NFS
Server:/share  /media/nfs  nfs  rsize=8192 and wsize=8192,noexec,nosuid
# "Server" = Samba server (by IP or name if you have an entry for the server in your hosts file
# "share" = name of the shared directory

#SSHFS
sshfs#user@server:/share  fuse  user,allow_other  0  0
# "Server" = Samba server (by IP or name if you have an entry for the server in your hosts file
# "share" = name of the shared directory
```

<span class="anchor" id="bkmrk--202"></span><span class="anchor" id="bkmrk--203"></span>

## File System Specific Examples

<span class="anchor" id="bkmrk--205"></span>

![IconsPage/example.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=example.png "IconsPage/example.png") Here are a couple of basic examples for different file system types. I will use /dev/sdb1 or /dev/hda2 for simplicity, but remember that any /dev location, UUID=&lt;some\_id&gt;, or LABEL=&lt;some\_label&gt; can work.<span class="anchor" id="bkmrk--206"></span><span class="anchor" id="bkmrk--207"></span>

### Extended file systems (ext)

<span class="anchor" id="bkmrk--209"></span>

Specifically, these are the [ext2](https://en.wikipedia.org/wiki/Ext2), [ext3](https://en.wikipedia.org/wiki/Ext3), and [ext4](https://en.wikipedia.org/wiki/Ext4) filesystems that are common as root filesystems in Linux. The main difference between ext2 and ext3 is that ext3 has journaling which helps protect it from errors when the system crashes. The more modern ext4 supports larger volumes along with other improvements, and is backward compatible with ext3.<span class="anchor" id="bkmrk--210"></span><span class="anchor" id="bkmrk--211"></span>

A root filesystem:<span class="anchor" id="bkmrk--212"></span><span class="anchor" id="bkmrk--213"></span><span class="anchor" id="bkmrk--214"></span>

```
UUID=30fcb748-ad1e-4228-af2f-951e8e7b56df / ext3 defaults,errors=remount-ro,noatime 0 1
```

<span class="anchor" id="bkmrk--216"></span><span class="anchor" id="bkmrk--217"></span>

A non-root file system, ext2:<span class="anchor" id="bkmrk--218"></span><span class="anchor" id="bkmrk--219"></span><span class="anchor" id="bkmrk--220"></span>

```
/dev/sdb1 /media/disk2 ext2 defaults 0 2
```

<span class="anchor" id="bkmrk--222"></span><span class="anchor" id="bkmrk--223"></span>

### File Allocation Table (FAT)

<span class="anchor" id="bkmrk--225"></span>

Specifically, [fat16 and fat32](https://en.wikipedia.org/wiki/File_Allocation_Table), which are common for USB flash drives and flash cards for cameras and other devices.<span class="anchor" id="bkmrk--226"></span><span class="anchor" id="bkmrk--227"></span><span class="anchor" id="bkmrk--228"></span>

```
/dev/hda2 /media/data1 vfat defaults,user,exec,uid=1000,gid=100,umask=000 0 0
```

<span class="anchor" id="bkmrk--230"></span><span class="anchor" id="bkmrk--231"></span>

<span class="anchor" id="bkmrk--233"></span><span class="anchor" id="bkmrk--234"></span>

```
/dev/sdb1 /media/data2 vfat defaults,user,dmask=027,fmask=137 0 0
```

<span class="anchor" id="bkmrk--236"></span><span class="anchor" id="bkmrk--237"></span>

### New Technology File System (NTFS)

<span class="anchor" id="bkmrk--239"></span>

[NTFS](https://en.wikipedia.org/wiki/NTFS) is typically used for a Windows partition.<span class="anchor" id="bkmrk--240"></span><span class="anchor" id="bkmrk--241"></span><span class="anchor" id="bkmrk--242"></span>

```
/dev/hda2 /media/windows ntfs-3g defaults,locale=en_US.utf8 0 0
```

<span class="anchor" id="bkmrk--244"></span>

For a list of locales available on your system, run<span class="anchor" id="bkmrk--245"></span>

- <span class="anchor" id="bkmrk--246"></span>```
     locale -a
    ```
    
    <span class="anchor" id="bkmrk--247"></span><span class="anchor" id="bkmrk--248"></span>

### Hierarchical File System (HFS)

<span class="anchor" id="bkmrk--250"></span>

[HFS](https://en.wikipedia.org/wiki/Hierarchical_File_System), or more commonly, [HFS+](https://en.wikipedia.org/wiki/HFS_Plus), are filesystems generally used by Apple computers.<span class="anchor" id="bkmrk--251"></span><span class="anchor" id="bkmrk--252"></span>

For Read/Write mounting:<span class="anchor" id="bkmrk--253"></span><span class="anchor" id="bkmrk--254"></span><span class="anchor" id="bkmrk--255"></span>

```
/dev/sdb2 /media/Macintosh_HD hfsplus rw,exec,auto,users 0 0
```

<span class="anchor" id="bkmrk--257"></span>

Note: if you want to write data on this partition, you **must** disable the journalization of this partition with **diskutil** under Mac OS.<span class="anchor" id="bkmrk--258"></span><span class="anchor" id="bkmrk--259"></span>

For Read only:<span class="anchor" id="bkmrk--260"></span><span class="anchor" id="bkmrk--261"></span><span class="anchor" id="bkmrk--262"></span>

```
/dev/sda2 /media/Machintosh_HD hfsplus ro,defaults 0 2
```

<span class="anchor" id="bkmrk--264"></span>

Note: if you want to have access to your files on Ubuntu, you must change the permission of the folders and contained files you want to access by doing in the apple terminal:<span class="anchor" id="bkmrk--265"></span><span class="anchor" id="bkmrk--266"></span><span class="anchor" id="bkmrk--267"></span>

```
sudo chmod -R 755 Folder
```

<span class="anchor" id="bkmrk--269"></span>

"Staff" group should have appeared in this folder's info. You can do this on Music and Movies to access these files from Ubuntu.<span class="anchor" id="bkmrk--270"></span><span class="anchor" id="bkmrk--271"></span>

# Editing fstab

<span class="anchor" id="bkmrk--273"></span>

![IconsPage/editor.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=editor.png "IconsPage/editor.png") Please, before you edit system files, **make a backup**. The -B flag with nano will make a backup automatically.<span class="anchor" id="bkmrk--274"></span><span class="anchor" id="bkmrk--275"></span>

To edit the file in Ubuntu, run:<span class="anchor" id="bkmrk--276"></span><span class="anchor" id="bkmrk--277"></span><span class="anchor" id="bkmrk--278"></span>

```
gksu gedit /etc/fstab
```

<span class="anchor" id="bkmrk--280"></span>

To edit the file in Kubuntu, run:<span class="anchor" id="bkmrk--281"></span><span class="anchor" id="bkmrk--282"></span><span class="anchor" id="bkmrk--283"></span>

```
kdesu kate /etc/fstab
```

<span class="anchor" id="bkmrk--285"></span>

To edit the file directly in terminal, run:<span class="anchor" id="bkmrk--286"></span><span class="anchor" id="bkmrk--287"></span><span class="anchor" id="bkmrk--288"></span>

```
sudo nano -Bw /etc/fstab
```

<span class="anchor" id="bkmrk--290"></span>

- -B = Backup origional fstab to /etc/fstab~ .<span class="anchor" id="bkmrk--291"></span>
- -w = disable wrap of long lines.<span class="anchor" id="bkmrk--292"></span><span class="anchor" id="bkmrk--293"></span>

Alternate:<span class="anchor" id="bkmrk--294"></span><span class="anchor" id="bkmrk--295"></span><span class="anchor" id="bkmrk--296"></span>

```
sudo -e /etc/fstab
```

<span class="anchor" id="bkmrk--298"></span><span class="anchor" id="bkmrk--299"></span>

## Useful Commands

<span class="anchor" id="bkmrk--301"></span>

![IconsPage/terminal.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=terminal.png "IconsPage/terminal.png") To view the contents of <tt>/etc/fstab</tt>, run the following terminal command:<span class="anchor" id="bkmrk--302"></span><span class="anchor" id="bkmrk--303"></span><span class="anchor" id="bkmrk--304"></span>

```
cat /etc/fstab
```

<span class="anchor" id="bkmrk--306"></span><span class="anchor" id="bkmrk--307"></span>

To get a list of all the UUIDs, use one of the following two commands:<span class="anchor" id="bkmrk--308"></span><span class="anchor" id="bkmrk--309"></span><span class="anchor" id="bkmrk--310"></span><span class="anchor" id="bkmrk--311"></span>

```
sudo blkid
ls -l /dev/disk/by-uuid
```

<span class="anchor" id="bkmrk--313"></span><span class="anchor" id="bkmrk--314"></span>

To list the drives and relevant partitions that are attached to your system, run:<span class="anchor" id="bkmrk--315"></span><span class="anchor" id="bkmrk--316"></span><span class="anchor" id="bkmrk--317"></span>

```
sudo fdisk -l
```

<span class="anchor" id="bkmrk--319"></span><span class="anchor" id="bkmrk--320"></span>

To mount all file systems in <tt>/etc/fstab</tt>, run:<span class="anchor" id="bkmrk--321"></span><span class="anchor" id="bkmrk--322"></span><span class="anchor" id="bkmrk--323"></span>

```
sudo mount -a
```

<span class="anchor" id="bkmrk--325"></span><span class="anchor" id="bkmrk--326"></span>

Remember that the mount point must already exist, otherwise the entry will not mount on the filesystem. To create a new mount point, use root privileges to create the mount point. Here is the generalization and an example:<span class="anchor" id="bkmrk--327"></span><span class="anchor" id="bkmrk--328"></span><span class="anchor" id="bkmrk--329"></span><span class="anchor" id="bkmrk--330"></span>

```
sudo mkdir /path/to/mountpoint
sudo mkdir /media/disk2
```

<span class="anchor" id="bkmrk--332"></span><span class="anchor" id="bkmrk--333"></span>

# Other Resources

<span class="anchor" id="bkmrk--335"></span>

![IconsPage/resources.png](https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=resources.png "IconsPage/resources.png") Here are some more links for your convenience:<span class="anchor" id="bkmrk--336"></span>

- [UsingUUID](https://help.ubuntu.com/community/UsingUUID)<span class="anchor" id="bkmrk--337"></span>
- [How to fstab](http://ubuntuforums.org/showthread.php?t=283131) (from the Ubuntu Forums)<span class="anchor" id="bkmrk--338"></span>
- [http://en.wikipedia.org/wiki/Fstab](http://en.wikipedia.org/wiki/Fstab)<span class="anchor" id="bkmrk--339"></span>
- [SettingUpNFSHowTo](https://help.ubuntu.com/community/SettingUpNFSHowTo)<span class="anchor" id="bkmrk--340"></span>
- [SettingUpSamba](https://help.ubuntu.com/community/SettingUpSamba)<span class="anchor" id="bkmrk--341"></span>
- [LinuxFilesystemsExplained](https://help.ubuntu.com/community/LinuxFilesystemsExplained)<span class="anchor" id="bkmrk--342"></span>
- [AutomaticallyMountPartitions](https://help.ubuntu.com/community/AutomaticallyMountPartitions)<span class="anchor" id="bkmrk--343"></span>
- [HowtoPartition](https://help.ubuntu.com/community/HowtoPartition)

# EXECUTAR COMANDOS AO EFETUAR LOGIN OU LOGOUT NO LINUX

Link: [https://www.vivaolinux.com.br/dica/Executar-comandos-ao-efetuar-login-ou-logout-no-Linux#google\_vignette](https://www.vivaolinux.com.br/dica/Executar-comandos-ao-efetuar-login-ou-logout-no-Linux#google_vignette)

Para que um comando seja executado quando o usuário efetua LOGIN (iniciar uma sessão) ou LOGOUT (finalizar a sessão), insira o seu comando nos respectivos arquivos que devem estar localizados no HOME de cada usuário:

- .bash\_login
- .bash\_logout

Obs.: Se estes arquivos não existirem, você deve criá-los.  
  
Exemplos:  
  
1\) Exibir uma mensagem quando o usuário efetua LOGIN (adicionar em .bash\_login):  
echo "Bem-vindo(a) ao [Linux](https://www.vivaolinux.com.br/linux/)!"

2\) Limpar a tela quando o usuário efetua LOGOUT (adicionar em .bash\_logout):  
clear

Para que os novos usuários herdem estes arquivos de configuração, copie-os para a pasta /etc/skel. Assim sempre que um novo usuário for criado, serão copiados os arquivos .bash\_login e .bash\_logout para sua pasta HOME.  
  
Espero que seja útil!

# O comando AWK com if, else e outras opções

Link: [https://blog.ironlinux.com.br/o-comando-awk/](https://blog.ironlinux.com.br/o-comando-awk/)

<div class="row justify-center" id="bkmrk-assim-como-o%C2%A0sed%C2%A0%2C-o" style="text-align: justify;"><article class="lg:col-10">Assim como o [SED](https://blog.ironlinux.com.br/o-comando-sed-no-linux) , o AWK é uma ferramenta para manipulação de texto. No entanto, o AWK também é considerado uma linguagem de programação. Com ele é possível pesquisar palavras num arquivo, identificar padrões, realizar substituições e muito mais! Além disso, o AWK suporta expressões regulares, o que permite realizar matches de padrões complexos.

## Output de exemplo

Antes de tudo, para realizarmos as operações/exemplos com o AWK, vamos utilizar a saída do comando **ps u**:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u

```

<div class="content mb-10"><div class="highlight"></div>[![Output do comando ps](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps_hu180624a0801036315a165abb38b8795b_18750_652x107_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps.png)</div>## 1 | Utilizações básicas

### 1.1 | Printar a primeira coluna

Para apresentar apena a primeira coluna é possível utilizar o comando abaixo. A primeira coluna é representada por **$1**:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk '{print $1}'

```

<div class="content mb-10"><div class="highlight"></div>[![Primeira coluna com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps1_hu40bf0526a869add2d330c0ce6e8f32a6_3217_244x123_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps1.png)</div>### 1.2 | Printar múltiplas colunas

É possível trazer múltiplas colunas utilizando o comando abaixo. OBS: A vírgula neste exemplo representará um espaço comum na saída final:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk '{print $1,$2,$3}'

```

<div class="content mb-10"><div class="highlight"></div>[![Múltiplas colunas com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps2_hu5298a6ce1fe8a70582a96b9331ce6162_9640_274x122_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps2.png)</div>### 1.3 | Printar múltiplas colunas separadas por Tab

Utilizando **"\\t"** é possível separar as colunas com Tab:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk '{print $1 "\t" $2 "\t" $3}'

```

<div class="content mb-10"><div class="highlight"></div>[![Múltiplas colunas separadas por tab com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps3_hucd7d7e596ee68c48a6155cdb16aca5bf_12368_357x127_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps3.png)</div>### 1.4 | Printar o último elemento

Utilizando **$NF** é possível trazer o último elemento (neste caso é a coluna COMMAND):

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk '{print $NF}'

```

<div class="content mb-10"><div class="highlight"></div>[![Último elemento/coluna com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps4_huee13c904e35975e64df63d3931d16746_8004_242x128_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ps4.png)</div>### 1.5 | Ignorar a primeira linha

É comum precisar remover a primeira linha de um arquivo para depois trabalhar com os dados. Para fazer isso, basta utilizar o comando abaixo:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk 'NR!=1'

```

<div class="content mb-10"><div class="highlight"></div>[![Ignorar primeira linha com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awk-1linha_hu05b53ab58852e2b82758cce26f5b64fb_18912_650x113_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awk-1linha.png)</div>### 1.6 | Substituir texto

Para substituir um texto, podemos utilizar a função **sub()**, conforme o exemplo abaixo, que substitui a string “**kali**” por “**outro-usuario**”:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk -e 'sub(/kali/, "outro-usuario")'

```

<div class="content mb-10"><div class="highlight"></div>[![Substituir texto com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awksub_hud9f2e6ec4736187a9a6160a1e1934855_21892_904x98_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awksub.png)</div>OBS: A função **sub()** substitui apenas a primeira ocorrência, uma vez por linha. Caso queira substituir mais de uma ocorrência, utilize a função **gsub()**.

## 2 | Utilizando um outro delimitador

Por padrão, o delimitador do AWK é o espaço (ou tab). No entanto, em alguns casos, você precisará indicar um outro delimitador (como por exemplo **vírgula** ou **ponto e vírgula**). Desta forma, no exemplo abaixo, estamos utilizando **;** como delimitador e printando o segundo elemento:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
echo 'oi;tudo;certo' | awk -F ';' '{print $2}'

```

<div class="content mb-10"><div class="highlight"></div>[![Alterar delimitador AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/delimitador_hud1b700e45a3865556df07ed4908ab68e_8393_415x64_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/delimitador.png)</div>## 3 | Condicionais

### 3.1 | AWK com if

Para exemplificar o uso de condicionais (if) vamos utilizar o arquivo **notas.txt** que possui o seguinte conteúdo:

<div class="content mb-10">[![IF no AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/notas-awk_hu0653596c22c5c588e3e591cfddb13782_7945_235x131_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/notas-awk.png)</div>Por exemplo, para printar a linha inteira se a primeira coluna for a string **Iron**:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
awk '{ if ($1 == "Iron") print $0 }' notas.txt

```

<div class="content mb-10"><div class="highlight"></div>[![Primeira coluna com if no AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/if1_huae5162889fdba2edda79031e243610d0_7955_434x59_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/if1.png)</div>Por exemplo, para printar a nota do aluno **Iron** em uma frase:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
awk '{ if ($1 == "Iron") print "A nota do Aluno", $1, "foi", $2}' notas.txt

```

<div class="content mb-10"><div class="highlight"></div>[![Manipulando output com if no AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/if2_hue5c6a73792c69eb177e191576a99da83_11466_663x63_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/if2.png)</div>### 3.2 | AWK com if/else

No exemplo abaixo estamos utilizando if/else para determinar quais alunos reprovaram ou passaram (com nota maior que 5). Também estamos utilizando **NR!=1** para ignorar a primeira linha:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
awk 'NR!=1 {if ($2 >=5 ) print $0,"=>","Passou!"; else print $0,"=>","Reprovou!"}' notas.txt

```

<div class="content mb-10"><div class="highlight"></div>[![AWK if e else](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ifelse_hu0aea360217126417a164d40544d60609_21178_785x111_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/ifelse.png)</div>## 3.3 | Cheatsheet de condicionais

<div class="content mb-10"><table><thead><tr><th>Condicionais</th><th>Descrição</th></tr></thead><tbody><tr><td>if ($5 &gt;= 10)</td><td>Se a quinta coluna for maior ou igual a 10</td></tr><tr><td>if ($3 == 10)</td><td>Se a terceira coluna for igual a 10</td></tr><tr><td>if ($1 == “Linux”)</td><td>Se a primeira coluna for igual a string **Linux**</td></tr><tr><td>if ($1 == “Linux”</td><td> </td></tr><tr><td>if ($1 ==“Linux” &amp;&amp; $2 &gt; 5)</td><td>Se a primeira coluna for igual a string **Linux** **e** a segunda coluna for **maior** que **5**</td></tr></tbody></table>

</div>## 4 | Utilizando REGEX

### 4.1 | Exemplos com REGEX

Na regex abaixo, estamos printando a linha inteira caso a segunda coluna se inicie com o número 1:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk -e '$2 ~ /^1/ {print $0}'

```

<div class="content mb-10"><div class="highlight"></div>[![Regex com AWK - exemplo 1](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awk-regex_hue8f336504f106075d7913aa5a67af0c9_12306_650x66_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awk-regex.png)</div>Na regex abaixo estamos printando todas as linhas cuja coluna 2 **não** comecem com o número 1:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
ps u | awk -e '$2 !~ /^1/ {print $0}'

```

<div class="content mb-10"><div class="highlight"></div>[![Regex com AWK - exemplo 2](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awk-regex2_hu343e058f96ed749dea6809523cfe1d3e_22855_779x110_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awk-regex2.png)</div>### 4.2 | Cheatsheet de REGEX

<div class="content mb-10"><table><thead><tr><th>Regex</th><th>Descrição</th></tr></thead><tbody><tr><td>\[mr\]</td><td>Letras\*\* m\*\* ou **r**</td></tr><tr><td>\[a-z\]</td><td>Qualquer letra de **a** à **z**</td></tr><tr><td>\[a-zA-Z\]</td><td>Qualquer letra de **A** à **Z** (maiúsculo ou minúsculo)</td></tr><tr><td>\[A-Z0-9\]{5}</td><td>5 caracteres, podendo ser qualquer letra de A à Z ou números de 0 a 9</td></tr></tbody></table>

</div>## 5 | Alguns outros usos interessantes

### 5.1 | Pegar linhas entre dois padrões

Vamos utilizar o arquivo **padrao.txt** abaixo para realizar as operações:

<div class="content mb-10">[![Coletar linhas entre padrões com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/padrao_hu5856180c72bc9dbad9abe8c237201352_7420_232x137_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/padrao.png)</div>Caso você queira printar, todas as linhas entre “**padrao1**” e “**padrao2**”:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
awk '/padrao1/{flag=1;next}/padrao2/{flag=0}flag' padrao.txt

```

<div class="content mb-10"><div class="highlight"></div>[![Linhas entre padrões com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/sempadroes_hu13a8c08b9c48a80f5489a97d5ef44904_11583_525x78_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/sempadroes.png)</div>Caso queira que “**padrao1**” e “**padrao2**” também seja printado:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
awk '/padrao1/{a=1}/padrao2/{print;a=0}a' padrao.txt

```

<div class="content mb-10"><div class="highlight"></div>[![Conteúdo entre padrões com AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/incluindo-awk_hu7950d1ebe0ea81691bf7bd0517119b58_13761_469x111_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/incluindo-awk.png)</div>### 5.2 | Adicionar um prefixo nas linhas

Para adicionar um prefixo nas linhas pode-se utilizar a função **gensub()**, veja o exemplo abaixo, onde adicionamos a palavra “Prefixos” em todas as linhas que comecem com caracteres alfanuméricos:

<div class="content mb-10"><button class="copy-code-button" type="button">Copiar</button><div class="highlight"></div></div>```bash
awk -e ' { print gensub(/^[a-zA-Z0-9]*/, "Prefixos &",1) }' notas.txt

```

<div class="content mb-10"><div class="highlight"></div>[![gensub no AWK](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awkprefixos_hub99131691dd910f7ec991e08f4ae1217_17865_603x114_fit_q100_h2_lanczos_3.webp)](https://blog.ironlinux.com.br/images/blog-posts/uploads/2022/04/awkprefixos.png)</div>Por fim, agradecemos a leitura e esperamos que este post tenha te ajudado de alguma maneira! Caso tenha alguma dúvida, entre em contato conosco pelo [Telegram](https://t.me/ironlinux) , [Facebook](https://www.facebook.com/ironlinuxoficial) ou [Instagram](https://www.instagram.com/ironlinux_/) ! Veja mais posts no [IronLinux](https://blog.ironlinux.com.br/) !

##### Tags:

<div class="row items-start justify-between"><div class="lg:col-5 mb-10 flex items-center lg:mb-0">  
- [Awk](https://blog.ironlinux.com.br/tags/awk/)
- [Comandos linux](https://blog.ironlinux.com.br/tags/comandos-linux/)
- [Linux](https://blog.ironlinux.com.br/tags/linux/)
- [Manipulação de texto](https://blog.ironlinux.com.br/tags/manipula%c3%a7%c3%a3o-de-texto/)
- [Sed](https://blog.ironlinux.com.br/tags/sed/)

</div><div class="lg:col-4 flex items-center"><div class="share-icons">  
</div></div></div><div class="row items-start justify-between"><div class="lg:col-4 flex items-center"></div></div></article></div>## Posts relacionados

<div class="section pb-0" id="bkmrk-" style="text-align: justify;"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">[<picture><source media="(max-width: 575px)" srcset="/images/blog-posts/uploads/2019/10/error_hucc2e0509482998e4b2d13b1c822b4379_20362_545x0_resize_q100_h2_lanczos_2.webp"><source media="(max-width: 767px)" srcset="/images/blog-posts/uploads/2019/10/error_hucc2e0509482998e4b2d13b1c822b4379_20362_600x0_resize_q100_h2_lanczos_2.webp"><source media="(max-width: 991px)" srcset="/images/blog-posts/uploads/2019/10/error_hucc2e0509482998e4b2d13b1c822b4379_20362_700x0_resize_q100_h2_lanczos_2.webp"><source srcset="/images/blog-posts/uploads/2019/10/error_hucc2e0509482998e4b2d13b1c822b4379_20362_1110x0_resize_q100_h2_lanczos_2.webp">![Redirecionar a saída padrão e de erros](https://blog.ironlinux.com.br/images/blog-posts/uploads/2019/10/error_hucc2e0509482998e4b2d13b1c822b4379_20362_1110x0_resize_q100_h2_lanczos_2.webp)</source></source></source></source></picture>](https://blog.ironlinux.com.br/redirecionar-saida-padrao-e-de-erros/)</div></div></div></div>#### [Redirecionar a saída padrão e de erros](https://blog.ironlinux.com.br/redirecionar-saida-padrao-e-de-erros/)

<div class="section pb-0" id="bkmrk-vinicius-souza-%C2%A0linu" style="text-align: justify;"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">- [Vinicius Souza](https://blog.ironlinux.com.br/authors/vinicius-souza/)
- [Linux](https://blog.ironlinux.com.br/categories/linux/)

</div></div></div></div>Quando é executado um comando ou algum script no Linux é possível redirecionar a saída padrão e de erros para não ser printado em tela ou que seja direcionado à algum lugar especifico.

<div class="section pb-0" id="bkmrk-ler-post-completo" style="text-align: justify;"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">[Ler post completo](https://blog.ironlinux.com.br/redirecionar-saida-padrao-e-de-erros/)</div></div><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">[<picture><source media="(max-width: 575px)" srcset="/images/blog-posts/uploads/2020/12/COMANDO-SED-1_hud2e12d6c9cec0cf7fb6055af72465bd8_131220_545x0_resize_q100_h2_lanczos_2.webp"><source media="(max-width: 767px)" srcset="/images/blog-posts/uploads/2020/12/COMANDO-SED-1_hud2e12d6c9cec0cf7fb6055af72465bd8_131220_600x0_resize_q100_h2_lanczos_2.webp"><source media="(max-width: 991px)" srcset="/images/blog-posts/uploads/2020/12/COMANDO-SED-1_hud2e12d6c9cec0cf7fb6055af72465bd8_131220_700x0_resize_q100_h2_lanczos_2.webp"><source srcset="/images/blog-posts/uploads/2020/12/COMANDO-SED-1_hud2e12d6c9cec0cf7fb6055af72465bd8_131220_1110x0_resize_q100_h2_lanczos_2.webp">![O comando SED no Linux](https://blog.ironlinux.com.br/images/blog-posts/uploads/2020/12/COMANDO-SED-1_hud2e12d6c9cec0cf7fb6055af72465bd8_131220_1110x0_resize_q100_h2_lanczos_2.webp)</source></source></source></source></picture>](https://blog.ironlinux.com.br/o-comando-sed-no-linux/)</div></div></div></div>#### [O comando SED no Linux](https://blog.ironlinux.com.br/o-comando-sed-no-linux/)

<div class="section pb-0" id="bkmrk-vinicius-souza-%C2%A0linu-1" style="text-align: justify;"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">- [Vinicius Souza](https://blog.ironlinux.com.br/authors/vinicius-souza/)
- [Linux](https://blog.ironlinux.com.br/categories/linux/)

</div></div></div></div>O comando SED é uma ótima ferramenta de edição de arquivos ou de formatação de resultados de comandos, com ele você pode pesquisar, localizar e substituir, inserir ou excluir palavras, números e etc.

<div class="section pb-0" id="bkmrk-ler-post-completo-1" style="text-align: justify;"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">[Ler post completo](https://blog.ironlinux.com.br/o-comando-sed-no-linux/)</div></div><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">[<picture><source media="(max-width: 575px)" srcset="/images/blog-posts/uploads/2020/04/Stress-ng-1_hu20ef07f6d87399612b4205b98ee978d4_28688_545x0_resize_q100_h2_lanczos_2.webp"><source media="(max-width: 767px)" srcset="/images/blog-posts/uploads/2020/04/Stress-ng-1_hu20ef07f6d87399612b4205b98ee978d4_28688_600x0_resize_q100_h2_lanczos_2.webp"><source media="(max-width: 991px)" srcset="/images/blog-posts/uploads/2020/04/Stress-ng-1_hu20ef07f6d87399612b4205b98ee978d4_28688_700x0_resize_q100_h2_lanczos_2.webp"><source srcset="/images/blog-posts/uploads/2020/04/Stress-ng-1_hu20ef07f6d87399612b4205b98ee978d4_28688_1110x0_resize_q100_h2_lanczos_2.webp">![Estressando MEM, DISCO e CPU com Stress-ng [Debian9]](https://blog.ironlinux.com.br/images/blog-posts/uploads/2020/04/Stress-ng-1_hu20ef07f6d87399612b4205b98ee978d4_28688_1110x0_resize_q100_h2_lanczos_2.webp)</source></source></source></source></picture>](https://blog.ironlinux.com.br/estressando-mem-disco-e-cpu-com-stress-ng-debian9/)</div></div></div></div>#### [Estressando MEM, DISCO e CPU com Stress-ng \[Debian9\]](https://blog.ironlinux.com.br/estressando-mem-disco-e-cpu-com-stress-ng-debian9/)

<div class="section pb-0" id="bkmrk-vinicius-souza-%C2%A0linu-2" style="text-align: justify;"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body">- [Vinicius Souza](https://blog.ironlinux.com.br/authors/vinicius-souza/)
- [Linux](https://blog.ironlinux.com.br/categories/linux/)

</div></div></div></div>O STRESS-NG Com a ferramenta Stress-ng podemos literalmente realizar o Stress de alguns recursos do seu servidor, sendo eles: Cpu, memória e disco.

<div class="section pb-0" id="bkmrk-ler-post-completo-2"><div class="row"><div class="lg:col-4"><div class="bg-body dark:bg-darkmode-body" style="text-align: justify;">[Ler post completo](https://blog.ironlinux.com.br/estressando-mem-disco-e-cpu-com-stress-ng-debian9/)</div></div></div></div>

# Verificar vida útil de um hard disk

Link: [https://www.hdsentinel.com/hard\_disk\_sentinel\_linux.php](https://www.hdsentinel.com/hard_disk_sentinel_linux.php)

<table border="0" cellpadding="0" cellspacing="0" id="bkmrk-hard-disk-sentinel-l" width="100%"><tbody><tr><td width="70%">## Hard Disk Sentinel Linux Edition (FREE)

</td><td align="right">[![Download Hard Disk Sentinel Linux version](https://www.hdsentinel.com/img/download.gif)](https://www.hdsentinel.com/hard_disk_sentinel_linux.php#download)</td></tr></tbody></table>

By using Hard Disk Sentinel Linux console edition, it is possible to examine the temperature and health information (and more) of **IDE, S-ATA (SATA II also), SCSI and [USB](https://www.hdsentinel.com/compatibility_usbharddisks.php)** hard disks connected to motherboard or external controller cards. **The user must be root to use this software or start it with sudo.**

To display hard disk / SSD status in a graphical interface, download [Hard Disk Sentinel Linux GUI (Graphical User Interface)](https://www.hdsentinel.com/hard_disk_sentinel_linux_gui.php) package. Thanks for Gregory25!

To simplify starting Hard Disk Sentinel Linux Edition, it is possible to use one of the [Linux Desktop Installers](https://www.hdsentinel.com/add-on-linux-installers.php) for the actual Linux distribution which allows starting directly from the desktop without the need of starting manually from a console. Thanks for Marc Sayer for these packages!

To receive daily status reports, please check the [HDSentinel\_EmailUtil.zip](https://www.hdsentinel.com/hdslin/hdsentinel_emailutil.zip) package. Thanks for Raul del Cid Lopez for this script!

<center id="bkmrk-">[![Hard Disk Sentinel Linux version](https://www.hdsentinel.com/hdslin/hdslin1.gif)](https://www.hdsentinel.com/hdslin/hdslin.jpg)</center>### List of features

- display hard disk / solid state disk information on the terminal
- create comprehensive report about the disk system, including both hard disk and SSD specific features (for example, media rotation rate, TRIM command, etc.)
- display and manage acoustic setting of hard disks (on supported USB disks also)
- offers outputs for both users and scripts/other applications to process

The following information are displayed:

- detected hard disk number and device name (for example /dev/sda)
- size, model ID, serial number, revision and interface of all detected hard disks
- temperature, health and performance values
- power on time (days, hour, minutes - if supported)  
    **Note**: this is for informational purposes only, the value displayed under Windows (after some minutes of testing) may be more accurate
- acoustic management settings (if supported and **-aam** or **-setaam** option is used

### Command line switches

The switches are NOT case sensitive. Upper and lower case can be used to specify them.

- **-h** - displays help and usage information
- **-r \[report file\]** - automatically save report to filename (default: report.txt)
- **-html** - use with -r to save HTML format report (-html -r report.html)
- **-mht** - use with -r to save MHT format report (-mht -r report.mht)
- **-autosd** - detect industrial SD card type and save flag file (see [How to: monitor (micro) SD card health and status](https://www.hdsentinel.com/how_to_monitor_sd_card_health_status.php) for more details)
- **-dev /dev/sdX** - detect and report only the specified device without accessing others
- **-devs d1,d2** - detect (comma separated) devices in addition to default ones eg. /dev/sda,/dev/sdb,/dev/sdc
- **-onlydevs d1,d2** - detect (comma separated) devices only eg. /dev/sda,/dev/sdb,/dev/sdc
- **-nodevs d1,d2** - exclude detection of (comma separated) devices eg. /dev/sda,/dev/sdb,/dev/sdc
- **-dump** - dump report to stdout (can be used with -xml to dump XML output instead of text)
- **-xml** - create and save XML report instead of TXT
- **-solid** - solid output (drive, tempC, health%, power on hours, model, S/N, size)
- **-verbose** - detailed detection information and save temporary files (only for debug purposes)
- **-aam** - display acoustic management settings (current and recommended level)
- **-setaam drive\_num|ALL level(hex)80-FE|QUIET|LOUD** - set acoustic level on drive 0..n (or all)  
    80 or QUIET is the lowest (most silent) setting, FE or LOUD is the highest (fastest) setting  
    For example: **hdsentinel -setaam 0 loud** - Configures drive 0 to fastest (loud) setting. Same as **hdsentinel -setaam 0 FE**

Please send saved XML or TXT reports, questions or ideas to <info@hdsentinel.com> to help improving this tool.

### License

Hard Disk Sentinel Linux edition is **FREE**. You can freely distribute and use it to analyse hard disk status. However, if you like this tool and would like to keep it updated, please support further development by registering the Windows version of the software.

### Usage of Hard Disk Sentinel Linux version

After downloading the file below, please follow these steps to use it:

- double click to open and decompress it to any folder
- open a terminal window and navigate to the folder
- change file permissions to make it executable by using **chmod 755 HDSentinel**
- launch it by entering **sudo ./HDSentinel \[options\]**  
    *sudo* is not required if you logged in as "root".

### Examples

Optimize complete system for silence: **hdsentinel -setaam all quiet**

Optimize complete system for high performance (but louder disk access): **hdsentinel -setaam all loud**

Select a balanced level between silence and performance on drive 0: **hdsentinel -setaam 0 C0**  
Note: some disks do not support balanced settings and they may select the most silent (80) or high performance (FE) setting instead.  
Please start **hsentinel** without parameters to see drive assignments (eg. /dev/sda) to drive indexes.

Due to the high amount of requests, it is possible to create minimal output which can be easily parsed and processed for further use. Some examples are:

List disk drives, temperature (in Celsius), health %, power on hours, disk model, disk serial, size:  
**hdsentinel -solid**. Sample results:

```
  /dev/sda 42   3  4830 WDC_WD800JD-8LSA0   WD-WMAM9F937837   76324
  /dev/sdb 30 100  6128 ST3250624A          5ND3J94R         238472
  /dev/sdc 46 100 10982 WDC_WD2500JS-00MHB0 WD-WCANK8705209  238475
  /dev/sdd  ?   ?     ? GENERIC_CF_READER   9999                  0
  /dev/sde  ?   ?     ? GENERIC_SD_READER   9999               1963
```

List only temperature, drive, size:  
**hdsentinel -solid | awk '{print $2, $1, $7}'**

```
  42 /dev/sda 76324 
  30 /dev/sdb 238472
  46 /dev/sdc 238475
  ? /dev/sdd 0      
  ? /dev/sde 1963   
```

List only temperature, drive, model ID, highest temperature on top, drives without temperature information (for example card readers) removed:  
**hdsentinel -solid | awk '{print $2, $1, $5}' | grep -v "^?" | sort -nr**

```
  46 /dev/sdc WDC_WD2500JS-00MHB0
  42 /dev/sda WDC_WD800JD-8LSA0  
  30 /dev/sdb ST3250624A         
```

List only health, temperature, drive, lowest health on top, drives without temperature information (for example card readers) removed:  
**hdsentinel -solid | awk '{print $3, $2, $1}' | grep -v "^?" | sort -n**

```
  3 42 /dev/sda  
  100 30 /dev/sdb
  100 46 /dev/sdc
```

Note that the spaces in hard disk model ID and serial number are replaced with underscore (\_).

If you have any ideas, thoughts about the automatic processing of output or if you have complete script(s) you want to share with other users, please [send a mail](mailto:info@hdsentinel.com) and it will be published on this page with the name and credits of the sender of the script.

<a name="download"></a>

### Download Hard Disk Sentinel Linux

<a name="download"></a>[Hard Disk Sentinel 32-bit Linux console version - **executable, gzip-compressed**](https://www.hdsentinel.com/hdslin/hdsentinel-019b.gz)

[Hard Disk Sentinel 64-bit Linux console version - **executable, zip-compressed**](https://www.hdsentinel.com/hdslin/hdsentinel-020c-x64.zip)

[Hard Disk Sentinel Linux console version for Raspberry PI (ARM CPU) - **executable, gzip-compressed**](https://www.hdsentinel.com/hdslin/hdsentinel-020-arm.gz)

[Hard Disk Sentinel Linux console version for NAS boxes (ARMv5 CPU) - **executable, non-compressed**](https://www.hdsentinel.com/hdslin/armv5/hdsentinelarm) (see notes below)

[Hard Disk Sentinel Linux console version for NAS boxes / Raspberry PI 4 (ARMv7 CPU) - **executable, gzip-compressed**](https://www.hdsentinel.com/hdslin/hdsentinel-armv7.gz)

[Hard Disk Sentinel Linux console version for NAS boxes / Raspberry PI 4 64-bit (ARMv8 / ARM64 CPU) - **executable, zip-compressed**](https://www.hdsentinel.com/hdslin/hdsentinel-armv8.zip)  
 Can be used with Synology D220j and other [Synology NAS models](https://github.com/SynoCommunity/spksrc/wiki/Architecture-per-Synology-model) with ARMv8 CPU

### Compatibility

Kernel support is required to detect and display information about SATA hard disks. This version was successfully tested under the following systems:

- blackPanther OS v16.2 SE
- CentOS 5, 6 and newer
- Fedora 5, 6, 7, 8, 9, 10, 15 and newer
- Ubuntu 8.04 server kernel 2.6.24-16-server, 9.04
- Kubuntu 8.04
- Xubuntu 8.04
- Slackware 11.0
- UHU Linux 2.1
- SuSe 10.2, SuSe 10.3 (SuSe 10.0 - NOT working, reports wanted)
- Debian Lenny 5.0
- Debian GNU/Linux 6.0.1 Squeez
- Raspberry PI (ARM CPU)
- NAS boxes (ARM CPU): WD MyBook Live, D-Link DNS-320LW two bay Sharecenter, D-Link DNS-327L two bay Sharecenter, Seagate FreeAgent DockStar, Zyxel NSA320, Synology DS211. DSM 5.0-4493 update 3

Successfully tested with Adaptec SCSI controllers and SCSI hard disks, and with external enclosures built with different USB-ATA bridge in chips [USB Hard disks, hard disk enclosures](https://www.hdsentinel.com/compatibility_usbharddisks.php). Supports LSI / Intel / IBM RAID controllers too.

### Updates

**0.20**

<table border="0" id="bkmrk-7%2F7%2F2023-added--devs"><tbody><tr><td valign="top" width="120">7/7/2023</td><td align="justify">- added -devs, -onlydevs, -nodevs command line switches to control which drives should be detected
- added support of Kingston DataTraveler MAX : detect health, temperature, S.M.A.R.T. status of Kingston DataTraveler MAX series pendrives
- added support of DockCase DSWC1P USB-M.2 (NVMe/SATA) adapter
- added support of ASUS Tuf Gaming A1 USB 3.2 NVMe adapter
- added support of ACOS SATA SSDs, Fanxiang S101, Go-Infinity SSD, ZOZT G3000, SQUARE ES 550, Ramsta R900 SSDs
- improved support and reporting of 22 TB WD hard disk drives, Toshiba 18 TB hard disk drives
- improved support/health display of SanDisk SDSSDH3 models when new/unused
- improved support of various SAS drives
- improved compatibility with various USB devices
- improved Health % reporting for intensively used Indilinx Barefoot SSD
- improved compatibility with GLOWAY SSD, HP SSD 600, Patriot Burst Elite SSD, Patriot P220 SSD, Patriot P210 SSD, PNY SSD, PNY ELITE SSD, Toshiba SATA SSD, Kingston SSD, Swissbit SSD
- improved support of some Sandisk, Intel, LiteOn SATA SSDs, Transcend TS120GSSD220S SSD, WDS120G2G0A-00, Lexar SATA SSD, XRAYDISK SATA SSD, KINGSPEC SATA SSD, WALRAM SSD
- improved support of Intel Pro 5400s SSDs
- improved support and Health % calculation / text reports for various Sandisk SSDs
- improved support and Health % calculation / text reports for various Patriot SSDs
- improved support and Health % calculation / text reports for various DELL-specific SSDs
- added support of Apricorn Fortress L3 and Padlock 3 external hard disk drives and Apricorn ASK3 or ASK3z Secure Key pendrives: in addition to the robust design and security functions the hard disk drives and pendrives supported by Hard Disk Sentinel: complete health, temperature, self-monitoring S.M.A.R.T. status detected and displayed.
- added support of SSK USB 3.1 / 3.2 Gen 2 (10 Gbps) NVMe adapter: detect NVMe SSD status
- added support of Kingston XS2000 SSD, Goodram CX400 G2, Zadak SSD
- improved support of some Acer SSDs, Sandisk SSDs, Lite-on SSDs
- added support of Kingston Design-In SSDs (OMSP0S3, OM4P0S3, OM8P0S3, OCP0S3)
- improved health/status reporting for PNY SATA SSDs
- improved display of power on time, health, status of newer WD / Hitachi SAS hard disk drives
- improved text description of NVMe SSDs upon different problems / error conditions
- adjusted calculation and reporting lower health on failing / problematic NVMe SSDs
- improved support and detection with Synology NAS devices

</td></tr></tbody></table>

**0.19**

<table border="0" id="bkmrk-28%2F2%2F2021-added-supp"><tbody><tr><td valign="top" width="120">28/2/2021</td><td align="justify">- added support of newer SATA, SAS, NVMe M.2 PCie SSDs: detect health, temperature, and complete self-monitoring S.M.A.R.T. status
- added support of newer hard disk drives, hybrid drives: detect health, temperature, and complete self-monitoring S.M.A.R.T. status
- added support of newer NVMe-USB adapters / converters
- added support of ORICO 3559U3 5-bay external USB 3.0 hard disk enclosure
- added support of Yottamaster 4-bay and FS5U3 5-bay external USB 3.0 hard disk enclosure
- improved **detection of NVMe M.2 SSDs** under Linux. Detect health, temperature and complete self-monitoring S.M.A.R.T. status of NVMe M.2 SSDs connected to motherboard (nvme0, nvme1, etc... devices)

</td></tr></tbody></table>

**0.18**

<table border="0" id="bkmrk-7%2F11%2F2019-added%C2%A0dete"><tbody><tr><td valign="top" width="120">7/11/2019</td><td align="justify">- added **detection of NVMe M.2 SSDs** under Linux. Detect health, temperature and complete self-monitoring S.M.A.R.T. status of NVMe M.2 SSDs connected to motherboard (nvme0, nvme1, etc... devices)
- added detection of NVMe M.2 SSDs with USB-NVMe adapters based on ASMEDIA ASM236x and JMicron JMS583 chipsets
- added detection of SAS hard disk drives and SSDs configured as RAID with LSI, Intel, Dell SAS RAID controllers
- added support for new hard disk and SSD models, identify self-monitoring status of Kingston, Intel, Samsung, KingDian, Sandisk, LiteOn, ADATA, Crucial, Corsair, Lenovo, Apacer, WD SSDs
- added/improved support of various Western Digital, Hitachi, Seagate, Toshiba hard disk drives
- added/improved support of Helium (He) filled hard disk drives
- added/improved support of numerous external USB adapters, USB-ATA bridges, docking stations
- fixed bug with empty memory card readers

</td></tr></tbody></table>

<center id="bkmrk--3">![Hard Disk Sentinel Linux NVMe SSD detection](https://www.hdsentinel.com/hdslin/img/hds-linux-nvme.png "Hard Disk Sentinel Linux NVMe SSD detection")</center><center id="bkmrk--4">![Hard Disk Sentinel Linux detection SAS hard disk in RAID configuration](https://www.hdsentinel.com/hdslin/img/hds-linux-sas.png "Hard Disk Sentinel Linux detection SAS hard disk in RAID configuration")</center>**0.17**

<table border="0" id="bkmrk-30%2F8%2F2017-added%C2%A0dete"><tbody><tr><td valign="top" width="120">30/8/2017</td><td align="justify">- added **detection of industrial micro SD cards** under Linux. Detect status immediately if the detection method of the micro SD card previously configured under the Windows - or if **-autosd** command line parameter specified to detect and save the detection method and use in all sub-sequent detections under Windows or Linux.  
    Note: with Raspberry PI, it is not possible to detect internal memory card status, just status of card in external USB memory card reader.
- added support of ASMedia ASM1352R dual drive (RAID) enclosures: detection of complete status of both hard disks
- added **-html** command line option to save HTML format report (-html -r reportfile.html)
- added **-mht** command line option to save MHT format report (-mht -r reportfile.mht)
- added support of more than 26 drives, detection of additional drives when required
- added support for new hard disk and SSD models, identify self-monitoring status

</td></tr></tbody></table>

<center id="bkmrk--5">![Hard Disk Sentinel Linux industrial SD memory card status](https://www.hdsentinel.com/hdslin/img/screenshot-sd1.png "Hard Disk Sentinel Linux industrial SD memory card status")</center><center id="bkmrk--6">![Hard Disk Sentinel Linux industrial SD memory card status in HTML report](https://www.hdsentinel.com/hdslin/img/screenshot-sd2.png "Hard Disk Sentinel Linux industrial SD memory card status in HTML report")</center><center id="bkmrk--7">![Hard Disk Sentinel Linux industrial SD memory card status and S.M.A.R.T. self monitoring values](https://www.hdsentinel.com/hdslin/img/screenshot-sd3.png "Hard Disk Sentinel Linux industrial SD memory card status and S.M.A.R.T. self monitoring values")</center>**0.16**

<table border="0" id="bkmrk-13%2F9%2F2016-added-supp"><tbody><tr><td valign="top" width="120">13/9/2016</td><td align="justify">- added support for Intel, IBM, LSI RAID controllers
- experimental support of JMicron external USB RAID boxes (contact for assistance)
- added support for 4000+ hard disk and SSD models, interpreting and displaying their self-monitoring status
- displaying lifetime writes for SSDs

</td></tr></tbody></table>

**0.08 - [Download Hard Disk Sentinel Linux 0.08 version](https://www.hdsentinel.com/hdslin/hdsentinel_008.zip)**

<table border="0" id="bkmrk-6%2F3%2F2012-more-hard-d"><tbody><tr><td valign="top" width="120">6/3/2012</td><td align="justify">- more hard disk drive / solid state disk details saved to report
- improved compatibility with USB hard disks and various disk controllers
- true 64 bit version released

</td></tr></tbody></table>

**0.03 - [Download this version](https://www.hdsentinel.com/hdslin/hdsentinel003.gz)**

<table border="0" id="bkmrk-21%2F7%2F2009-more-hard-"><tbody><tr><td valign="top" width="120">21/7/2009</td><td align="justify">- more hard disk drive / solid state disk details saved to report
- -aam and -setaam commands to modify acoustic level of disk drives
- -dump to dump report to stdout
- -solid option to create solid output for further processing
- improved power on time detection for Samsung, Maxtor, Toshiba, Fujitsu models
- improved detection of SCSI and USB drives
- detection of SCSI and USB drive capacities

</td></tr></tbody></table>

**0.02 - [Download this version](https://www.hdsentinel.com/hdslin/hdsentinel002.gz)**

<table border="0" id="bkmrk-25%2F7%2F2008-added-supp"><tbody><tr><td valign="top" width="120">25/7/2008</td><td align="justify">- added support for SCSI and [USB hard disks](https://www.hdsentinel.com/compatibility_usbharddisks.php)
- improved temperature detection on Fujitsu hard disks

</td></tr></tbody></table>

**0.01 - [Download this version](https://www.hdsentinel.com/hdslin/hdsentinel001.gz)**

<table border="0" id="bkmrk-29%2F4%2F2008-first-init"><tbody><tr><td valign="top" width="120">29/4/2008</td><td align="justify">- first initial version

</td></tr></tbody></table>

### Raspberry PI

<center id="bkmrk--8">![Hard Disk Sentinel Linux version running on Raspberry PI](https://www.hdsentinel.com/hdslin/raspberry_pi.png "Hard Disk Sentinel Linux version running on Raspberry PI")</center>### NAS boxes with ARM CPU

<center id="bkmrk--9">![Hard Disk Sentinel Linux version running on D-Link DNS-320LW](https://www.hdsentinel.com/hdslin/armv5/armv5.png "Hard Disk Sentinel Linux version running on D-Link DNS-320LW")</center>The Linux version of Hard Disk Sentinel also available for NAS boxes built with ARM CPUs. The NAS box should have telnet / SSH access in order to download and use this tool.

To get Telnet / SSH access, special firmware version(s) or additional packages (like the [fun\_plug](http://nas-tweaks.net/371/hdd-installation-of-the-fun_plug-0-7-on-nas-devices/) may be required. **Putty** tool is also required to connect the NAS box and access its console.

**Usage:**

- get Telnet / SSH access to the NAS box and log-in to your device by using putty.exe
- enter **wget http://www.hdsentinel.com/hdslin/armv5/hdsentinelarm** to download the latest ARMv5 CPU build.  
    To simplify things, the file is not compressed.
- enter **chmod 755 hdsentinelarm** to set the proper permission (executable). You may use **chmod +x hdsentinelarm** instead.
- enter **./hdsentinelarm** to start the Hard Disk Sentinel on the NAS and get hard disk status information.

**Tested on:**

- WD MyBook Live
- D-Link DNS-320LW two bay Sharecenter
- Seagate FreeAgent DockStar

# Some useful ssh config option

Link: [https://taozhi.medium.com/some-useful-ssh-config-option-7858a58c5e7b](https://taozhi.medium.com/some-useful-ssh-config-option-7858a58c5e7b)

When managing multiple Linux servers, we use SSH for logging in and performing tasks. Understanding how to configure SSH properly is essential for efficient server management.

# Basic Config

```
Host my_jump<br></br>    identityfile "~/.ssh/my_jump"<br></br>    hostname 47.254.197.212<br></br>    hostkeyalias my_jump<br></br>    user root<br></br>    port 22
```

In the above config, “my\_jump” is the hostname supporting wildcards to match multiple servers simultaneously.

The identityfile specifies the authorized private keys, hostname is the server’s IP address, and hostkeyalias is useful for connecting to the server when its IP address changes without needing to update known\_hosts. The user and port specify the SSH login credentials.

# Reuse the sock

Upon relogging into the server, how can we bypass entering the password and reuse the previous session to quickly reconnect? We should the control setting in ssh config.

```
Host *<br></br>    serveraliveinterval 60<br></br>    keepalive yes<br></br>    controlmaster auto<br></br>    controlpath ~/.ssh/socks/%h-%k-%p-%r<br></br>    controlpersist yes
```

By using the above configuration, we set the controlpath for all servers using the ‘\*’ symbol in the Host field. The controlpath specifies the socket path.

%h represents the host IP.

%k represents the hostname.

%p represents the port.

%r represents the username.

When you connect to a server using ssh, you should see a socket file present. `~/.ssh/socks`.

<div class="fj fk fl fm fn" id="bkmrk-" style="text-align: justify;"><div class="ab cb"><div class="ci bh ev ew ex ey"><figure class="nc nd ne nf ng ob ny nz paragraph-image"><div class="oc od ed oe bh of" role="button" tabindex="0"><div class="ny nz oa"><picture><source sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px" srcset="https://miro.medium.com/v2/resize:fit:640/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 640w, https://miro.medium.com/v2/resize:fit:720/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 720w, https://miro.medium.com/v2/resize:fit:750/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 750w, https://miro.medium.com/v2/resize:fit:786/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 786w, https://miro.medium.com/v2/resize:fit:828/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 828w, https://miro.medium.com/v2/resize:fit:1100/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 1100w, https://miro.medium.com/v2/resize:fit:1400/format:webp/1*EFp-htHJ0ldUFPSLuPU1YA.png 1400w" type="image/webp"><source data-testid="og" sizes="(min-resolution: 4dppx) and (max-width: 700px) 50vw, (-webkit-min-device-pixel-ratio: 4) and (max-width: 700px) 50vw, (min-resolution: 3dppx) and (max-width: 700px) 67vw, (-webkit-min-device-pixel-ratio: 3) and (max-width: 700px) 65vw, (min-resolution: 2.5dppx) and (max-width: 700px) 80vw, (-webkit-min-device-pixel-ratio: 2.5) and (max-width: 700px) 80vw, (min-resolution: 2dppx) and (max-width: 700px) 100vw, (-webkit-min-device-pixel-ratio: 2) and (max-width: 700px) 100vw, 700px" srcset="https://miro.medium.com/v2/resize:fit:640/1*EFp-htHJ0ldUFPSLuPU1YA.png 640w, https://miro.medium.com/v2/resize:fit:720/1*EFp-htHJ0ldUFPSLuPU1YA.png 720w, https://miro.medium.com/v2/resize:fit:750/1*EFp-htHJ0ldUFPSLuPU1YA.png 750w, https://miro.medium.com/v2/resize:fit:786/1*EFp-htHJ0ldUFPSLuPU1YA.png 786w, https://miro.medium.com/v2/resize:fit:828/1*EFp-htHJ0ldUFPSLuPU1YA.png 828w, https://miro.medium.com/v2/resize:fit:1100/1*EFp-htHJ0ldUFPSLuPU1YA.png 1100w, https://miro.medium.com/v2/resize:fit:1400/1*EFp-htHJ0ldUFPSLuPU1YA.png 1400w">![](https://miro.medium.com/v2/resize:fit:945/1*EFp-htHJ0ldUFPSLuPU1YA.png)</source></source></picture></div></div></figure></div></div></div># Set Jump Server

To secure production servers inaccessible for direct login, we can first connect to a jump server, then use SSH through the jump server to access the production server. Automating this process is possible by configuring ProxyCommand or ProxyJump in the SSH settings.

Config the jump server a and b first.

```
Host jump-server-a<br></br> HostKeyAlias jump-server-a<br></br> Hostname 100.97.200.66<br></br><br></br>Host jump-server-b<br></br> HostKeyAlias jump-server-b<br></br> Hostname 100.97.200.67<br></br><br></br>Host jump-server-*<br></br> HashKnownHosts no<br></br> ServerAliveInterval 60<br></br> Port 22<br></br> User root<br></br> PreferredAuthentications publickey<br></br> IdentityFile ~/.ssh/id_taozhi<br></br> Controlpath ~/.ssh/socks/%h-%k-%p-%r<br></br> ControlMaster auto<br></br> ControlPersist 5m<br></br> setenv LC_ALL=C.UTF-8
```

Config the production servers

```
Host production-server-a<br></br> ProxyJump jump-server-a<br></br><br></br>Host production-server-b<br></br> ProxyJump jump-server-b<br></br><br></br>Host production-server-c<br></br> ProxyCommand ssh -W %h:%p jump-server-b<br></br><br></br>Host production-server-*<br></br> LogLevel ERROR<br></br> UserKnownHostsFile /dev/null<br></br> StrictHostKeyChecking no<br></br> Port 22<br></br> User root<br></br> IdentityFile ~/.ssh/id_taozhi<br></br> controlmaster no<br></br> setenv LC_ALL=C.UTF-8
```

Following configuration, we can login to the production server locally.

```
ssh -o Hostname=172.16.28.19 production-server-a
```

You can log in to the production server with one command now.

<div class="ab cb oh oi oj ok" id="bkmrk--1" role="separator" style="text-align: justify;">  
</div># Conclusions

SSH is a versatile command with numerous configuration options. More options can be found for reading [here](https://linux.die.net/man/5/ssh_config). If you have any useful ssh config you are using, please comment it, let using it together.

# Acesso SSH via web

Link: [https://github.com/butlerx/wetty/tree/main](https://github.com/butlerx/wetty/tree/main)

# WeTTY = Web + TTY.

<div class="markdown-heading" dir="auto" id="bkmrk-" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#wetty--web--tty)</div>[![All Contributors](https://camo.githubusercontent.com/9aa2deae168828b34be1676d375ad2841cac0c198a83373e35a72ac44b83a87d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f616c6c5f636f6e7472696275746f72732d34312d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](https://github.com/butlerx/wetty#contributors-)

[![Documentation](https://camo.githubusercontent.com/477e3b9f33ae65e1572c4ca7d282e5517820e1a8d529ca2bdd1f5e63b3b14c13/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63756d656e746174696f6e2d7965732d627269676874677265656e2e737667)](https://github.com/butlerx/wetty/tree/main/docs) [![License: MIT](https://camo.githubusercontent.com/6cd0120cc4c5ac11d28b2c60f76033b52db98dac641de3b2644bb054b449d60c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://github.com/butlerx/wetty/blob/main/LICENSE)

> Terminal access in browser over http/https

[![WeTTY](https://github.com/butlerx/wetty/raw/main/docs/terminal.png?raw=true)](https://github.com/butlerx/wetty/blob/main/docs/terminal.png?raw=true)

Terminal over HTTP and https. WeTTY is an alternative to ajaxterm and anyterm but much better than them because WeTTY uses xterm.js which is a full fledged implementation of terminal emulation written entirely in JavaScript. WeTTY uses websockets rather than Ajax and hence better response time.

## Prerequisites

<div class="markdown-heading" dir="auto" id="bkmrk--4" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#prerequisites)</div>- node &gt;=18
- make
- python
- build-essential

## Install

<div class="markdown-heading" dir="auto" id="bkmrk--6" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#install)</div>```
npm -g i wetty
```

<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" id="bkmrk--8" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>## Usage

<div class="markdown-heading" dir="auto" id="bkmrk--9" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#usage)</div>```
$ wetty --help
Options:
  --help, -h      Print help message                                   [boolean]
  --version       Show version number                                  [boolean]
  --conf          config file to load config from                       [string]
  --ssl-key       path to SSL key                                       [string]
  --ssl-cert      path to SSL certificate                               [string]
  --ssh-host      ssh server host                                       [string]
  --ssh-port      ssh server port                                       [number]
  --ssh-user      ssh user                                              [string]
  --title         window title                                          [string]
  --ssh-auth      defaults to "password", you can use "publickey,password"
                  instead                                               [string]
  --ssh-pass      ssh password                                          [string]
  --ssh-key       path to an optional client private key (connection will be
                  password-less and insecure!)                          [string]
  --ssh-config    Specifies an alternative ssh configuration file. For further
                  details see "-F" option in ssh(1)                     [string]
  --force-ssh     Connecting through ssh even if running as root       [boolean]
  --known-hosts   path to known hosts file                              [string]
  --base, -b      base path to wetty                                    [string]
  --port, -p      wetty listen port                                     [number]
  --host          wetty listen host                                     [string]
  --command, -c   command to run in shell                               [string]
  --allow-iframe  Allow wetty to be embedded in an iframe, defaults to allowing
                  same origin                                          [boolean]
```

<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" id="bkmrk--11" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>Open your browser on `http://yourserver:3000/wetty` and you will prompted to login. Or go to `http://yourserver:3000/wetty/ssh/<username>` to specify the user beforehand.

If you run it as root it will launch `/bin/login` (where you can specify the user name), else it will launch `ssh` and connect by default to `localhost`. The SSH connection can be forced using the `--force-ssh` option.

If instead you wish to connect to a remote host you can specify the `--ssh-host` option, the SSH port using the `--ssh-port` option and the SSH user using the `--ssh-user` option.

Check out the [Flags docs](https://butlerx.github.io/wetty/flags) for a full list of flags

### Docker container

<div class="markdown-heading" dir="auto" id="bkmrk--12" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#docker-container)</div>To use WeTTY as a docker container, a docker image is available on [docker hub](https://hub.docker.com/r/wettyoss/wetty). To run this image, use

```
docker run --rm -p 3000:3000 wettyoss/wetty --ssh-host=<YOUR-IP>
```

<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" id="bkmrk--14" style="text-align: justify;"><div class="zeroclipboard-container"><svg aria-hidden="true" class="octicon octicon-copy js-clipboard-copy-icon" data-view-component="true" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"></path><path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"></path></svg></div></div>and you will be able to open a ssh session to the host given by `YOUR-IP` under the URL [http://localhost:3000/wetty](http://localhost:3000/wetty).

It is recommended to drive WeTTY behind a reverse proxy to have HTTPS security and possibly Let’s Encrypt support. Popular containers to achieve this are [nginx-proxy](https://github.com/nginx-proxy/nginx-proxy) and [traefik](https://traefik.io/traefik/). For traefik there is an example docker-compose file in the containers directory.

## FAQ

<div class="markdown-heading" dir="auto" id="bkmrk--15" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#faq)</div>Check out the [docs](https://github.com/butlerx/wetty/tree/main/docs)

- [Running as daemon](https://butlerx.github.io/wetty/service)
- [HTTPS Support](https://butlerx.github.io/wetty/https)
    - [Using NGINX](https://butlerx.github.io/wetty/nginx)
    - [Using Apache](https://butlerx.github.io/wetty/apache)
- [Automatic Login](https://butlerx.github.io/wetty/auto-login)
- [Downloading Files](https://butlerx.github.io/wetty/downloading-files)

### What browsers are supported?

<div class="markdown-heading" dir="auto" id="bkmrk--17" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#what-browsers-are-supported)</div>WeTTY supports all browsers that [xterm.js supports](https://github.com/xtermjs/xterm.js#browser-support).

## Author

<div class="markdown-heading" dir="auto" id="bkmrk--19" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#author)</div>👤 **Cian Butler <butlerx@notthe.cloud>**

- Mastodon: [@butlerx@mastodon.ie](https://mastodon.ie/@butlerx)
- Github: [@butlerx](https://github.com/butlerx)

## Contributing ✨

<div class="markdown-heading" dir="auto" id="bkmrk--21" style="text-align: justify;">[<svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewbox="0 0 16 16" width="16"><path d="m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z"></path></svg>](https://github.com/butlerx/wetty#contributing-)</div>Contributions, issues and feature requests are welcome!  
Feel free to check [issues page](https://github.com/butlerx/wetty/issues).

Please read the [development docs](https://butlerx.github.io/wetty/development) for installing from source and running is dev node

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

# Como baixar repositórios de imagens do Bitnami

Informação extraída do ChatGPT

O endereço que você passou:

> `https://github.com/bitnami/containers/tree/main/bitnami/suitecrm/8/debian-12`

...é uma **página de diretório no GitHub**, não um servidor de arquivos direto. Portanto, você **não pode usar `wget` ou `curl`** para baixar o diretório diretamente.

Mas há **duas formas corretas** de baixar esse conteúdo:

---

## ✅ Opção 1: Clonar apenas esse diretório com `git sparse-checkout` (recomendado)

Se você **não quiser baixar o repositório todo**, mas apenas esse diretório, use `git sparse-checkout`.

### Passos:

\# 1. Clone o repositório, mas sem o conteúdo  
git clone --depth 1 --filter=blob:none --sparse https://github.com/bitnami/containers.git

\# 2. Vá para a pasta clonada  
cd containers

\# 3. Ative sparse-checkout para baixar só o diretório desejado  
git sparse-checkout set bitnami/suitecrm/8/debian-12

### Resultado:

Você terá **somente a pasta `bitnami/suitecrm/8/debian-12`** localmente, sem baixar o repositório completo (~centenas de MB normalmente).

---

## ✅ Opção 2: Baixar o repositório inteiro (caso aceite o tamanho maior)

Se preferir baixar tudo (incluindo outras imagens), use:

git clone [https://github.com/bitnami/containers.git](https://github.com/bitnami/containers.git)

Depois navegue até:

cd containers/bitnami/suitecrm/8/debian-12

## ❌ Por que `wget` ou `curl` não funciona?

- GitHub **não oferece diretórios como arquivos ZIP automaticamente** via URL de pasta.
- `wget` baixaria o HTML da página, não os arquivos reais do diretório.

#### **Shell Script para baixar aplicativos pelo caminho no Bitnami**

\#!/bin/bash

echo "🔧 Exemplo de caminho: bitnami/suitecrm/8/debian-12"  
read -p "Digite o caminho completo do diretório no repositório Bitnami Containers: " TARGET\_DIR

\# Repositório Bitnami Containers  
REPO\_URL="https://github.com/bitnami/containers.git"  
REPO\_DIR="bitnami-containers"

\# Limpar se pasta já existir  
if \[ -d "$REPO\_DIR" \]; then  
 echo "Removendo pasta existente: $REPO\_DIR"  
 rm -rf "$REPO\_DIR"  
fi

echo -e "\\n📦 Iniciando download do diretório '$TARGET\_DIR'...\\n"

\# Clonar com sparse-checkout  
git clone --depth 1 --filter=blob:none --sparse "$REPO\_URL" "$REPO\_DIR" || {  
 echo "❌ Falha ao clonar repositório."  
 exit 1  
}

cd "$REPO\_DIR" || {  
 echo "❌ Erro ao acessar diretório $REPO\_DIR"  
 exit 1  
}

\# Baixar apenas o diretório informado  
if git sparse-checkout set "$TARGET\_DIR"; then  
 echo -e "\\n✅ Diretório '$TARGET\_DIR' baixado com sucesso!"  
 echo "📁 Caminho local: $REPO\_DIR/$TARGET\_DIR"  
else  
 echo -e "\\n❌ Diretório '$TARGET\_DIR' não encontrado no repositório."  
 exit 1  
fi

# Links para Ícones e Logotipos

LInk: [https://iconduck.com/](https://iconduck.com/)

# Configurações Linux

Ferramentas para administração Linux

# How to Use the Linux rsync Command

Link: [https://www.hostinger.com/tutorials/how-to-use-rsync](https://www.hostinger.com/tutorials/how-to-use-rsync)

Copying files from one device to another can be a cumbersome task. Fortunately, you can simplify this process on Linux using the **rsync** command.

**rsync**, short for remote sync, lets you transfer and synchronize files or folders between local devices and remote Linux-based servers. Whether you’re a pro or just getting started, mastering the **rsync** command can streamline your Linux file management.

This article will delve deep into the **rsync** command and how it works. We’ll also demonstrate how to use the **rsync** command through practical examples.

<div class="ez-toc-v2_0_67_1 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction" id="bkmrk-what-is-rsync%3F-how-d" style="text-align: justify;"><nav>- [What Is rsync?](https://www.hostinger.com/tutorials/how-to-use-rsync#What_Is_rsync "What Is rsync?")
- [How Does rsync Work?](https://www.hostinger.com/tutorials/how-to-use-rsync#How_Does_rsync_Work "How Does rsync Work?")
    - [rsync Options and Parameters](https://www.hostinger.com/tutorials/how-to-use-rsync#rsync_Options_and_Parameters "rsync Options and Parameters")
    - [Basic Syntax](https://www.hostinger.com/tutorials/how-to-use-rsync#Basic_Syntax "Basic Syntax")
    - [Basic Syntax for Remote Shell](https://www.hostinger.com/tutorials/how-to-use-rsync#Basic_Syntax_for_Remote_Shell "Basic Syntax for Remote Shell")
- [How to Check the rsync Version](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Check_the_rsync_Version "How to Check the rsync Version")
- [How to Install rsync](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Install_rsync "How to Install rsync")
- [How to Use rsync Commands](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Use_rsync_Commands "How to Use rsync Commands")
    - [Most Common rsync Commands](https://www.hostinger.com/tutorials/how-to-use-rsync#Most_Common_rsync_Commands "Most Common rsync Commands")
    - [How to Use rsync Commands With Subdirectories](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Use_rsync_Commands_With_Subdirectories "How to Use rsync Commands With Subdirectories")
    - [How to Synchronize Files](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Synchronize_Files "How to Synchronize Files")
    - [How to Combine rsync Commands](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Combine_rsync_Commands "How to Combine rsync Commands")
    - [Other Options for rsync Commands](https://www.hostinger.com/tutorials/how-to-use-rsync#Other_Options_for_rsync_Commands "Other Options for rsync Commands")
    - [How to Add a Progress Bar](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Add_a_Progress_Bar "How to Add a Progress Bar")
    - [How to Create an rsync Backup](https://www.hostinger.com/tutorials/how-to-use-rsync#How_to_Create_an_rsync_Backup "How to Create an rsync Backup")
- [rsync FAQ](https://www.hostinger.com/tutorials/how-to-use-rsync#rsync_FAQ "rsync FAQ")
    - [What Operating Systems Are Compatible With rsync?](https://www.hostinger.com/tutorials/how-to-use-rsync#What_Operating_Systems_Are_Compatible_With_rsync "What Operating Systems Are Compatible With rsync?")
    - [How Does rsync Differ From Other File Transfer Methods?](https://www.hostinger.com/tutorials/how-to-use-rsync#How_Does_rsync_Differ_From_Other_File_Transfer_Methods "How Does rsync Differ From Other File Transfer Methods?")
    - [Are There Any Limitations or Drawbacks to Using rsync?](https://www.hostinger.com/tutorials/how-to-use-rsync#Are_There_Any_Limitations_or_Drawbacks_to_Using_rsync "Are There Any Limitations or Drawbacks to Using rsync?")

</nav></div>## <span class="ez-toc-section" id="bkmrk-"></span>What Is rsync?

  
**rsync** is a powerful and versatile [Linux command](https://www.hostinger.com/tutorials/linux-commands) for transferring and synchronizing files between local and remote devices. Unlike traditional copy commands, **rsync** uses a delta-transfer algorithm to only transmit the differences between the source and destination files. This approach drastically reduces bandwidth usage and speeds up transfers.

**rsync** also has robust features for transferring files to a backup server and mirroring tasks. It preserves file attributes and supports secure transfers over SSH, making it suitable for both local and remote file transfers.

## <span class="ez-toc-section" id="bkmrk--1"></span>How Does rsync Work?

This section will explore various **rsync** options and basic syntax for different purposes.

### <span class="ez-toc-section" id="bkmrk--2"></span>rsync Options and Parameters

**rsync** has numerous command line options, parameters, and configuration files to tailor its behavior. Here are some commonly used ones:

- **-v or –verbose** – Increase verbosity, providing more detailed output during the transfer.
- **-a or –archive** – Archive mode, which includes recursive copying and preserving file permissions, timestamps, [symbolic links](https://www.hostinger.com/tutorials/how-to-create-symbolic-links-in-linux), and device files.
- **-r or –recursive** – Recursively copy directories.
- **–delete** – Delete excluded files from the destination directory.
- **–exclude=PATTERN** – Exclude files or directories matching the specified pattern.
- **–include=PATTERN** – Include files or directories matching the specified pattern.
- **-z or –compress** – Compress file data during the transfer to reduce bandwidth usage.
- **-s or –sparse** – Generate a summary of synchronized files and directories, including sparse files, after a sync operation.
- **–dry-run** – Perform a trial run without making any actual changes.
- **–temp-dir** – Specify a directory to store temporary files.
- **-u or –update** – Skip files on the destination side that are newer than the source files so only older files are updated.
- **-h or –human-readable** – Output numbers in a human-readable format.
- **-i or –itemize-changes** – Output a list of changes made during the transfer.
- **–progress** – Show progress during the transfer.
- **–stats** – Provides file transfer stats after it is complete.
- **-e or –rsh=COMMAND** – Specify which remote shell to use.
- **–bwlimit=RATE** – Limit the bandwidth to increase network efficiency.
- **-P or –partial –progress** – Keep partially transferred files and show progress.

For a comprehensive list of all available **rsync** options, run the following command:

```
man rsync
```

You will see detailed information about each option and parameter.

### <span class="ez-toc-section" id="bkmrk--3"></span>Basic Syntax

The basic syntax of an **rsync** command is as follows:

```
rsync [OPTIONS] SOURCE DESTINATION
```

- **\[OPTIONS\]** – This is the section where you can include **rsync** options. You can add more than one option.
- **SOURCE** – This is the source directory or file you want to copy or synchronize. Specify the path to the source data here.
- **DESTINATION** – The destination directory where the source data will be copied or synchronized. Specify the path to the destination directory or file here.

### <span class="ez-toc-section" id="bkmrk--4"></span>Basic Syntax for Remote Shell

When using **rsync** to transfer data from a local computer to a Linux [virtual private server](https://www.hostinger.com/tutorials/what-is-vps-hosting) (VPS), communication relies on the **rsync** daemon. The **rsync** syntax for the remote shell is as follows:

```
rsync [OPTIONS] -e "SSH_COMMAND" SOURCE DESTINATION
```

The **-e** option is used to specify the remote shell. In most cases, you’ll use **ssh** to connect to the remote host using the **rsync** remote update protocol.

Let’s explore two common scenarios.

Use the following command to pull data from a remote system to your local machine:

```
rsync -avz -e ssh user@remote_host:/path/to/source/ /path/to/local/destination/
```

Use the following command to push data from your local file system to a remote directory using the **CVS** protocol:

```
rsync -avz /path/to/local/source/ user@remote_host:/path/to/remote/destination/
```

## <span class="ez-toc-section" id="bkmrk--5"></span>How to Check the rsync Version

**rsync** is typically included by default in many [Linux distributions](https://www.hostinger.com/tutorials/best-linux-distro). Let’s check whether **rsync** is already installed on your system.

For Windows users working with [VPS Hosting](https://www.hostinger.com/vps-hosting), [use PuTTY SSH](https://www.hostinger.com/tutorials/how-to-use-putty-ssh) to log in. If you’re using macOS or Linux, access Terminal.

Once logged in, execute the command below:

```
rsync --version
```

You’ll receive an output similar to the following:

```
rsync version 3.2.7 protocol version 31
```

## <span class="ez-toc-section" id="bkmrk--6"></span>How to Install rsync

If **rsync** isn’t pre-installed on your local or remote machine, go ahead and install it manually. Here are the installation commands for different operating systems:

For Debian-based distributions, including Ubuntu:

```
sudo apt-get install rsync
```

For Fedora-based distributions, such as CentOS:

```
sudo dnf install rsync
```

For macOS:

```
brew install rsync
```

## <span class="ez-toc-section" id="bkmrk--7"></span>How to Use rsync Commands

Before learning to use **rsync**, let’s prepare two test directories named **original** and **duplicate**. The **original** directory will contain three sample files, while the **duplicate** directory will start out empty.

To create these directories, follow these commands:

```
cd
mkdir original
mkdir duplicate
```

Next, create three sample files inside the **original** folder:

```
touch original/file{1..3}
```

To make sure all the sample files are created, list all the files in the **original** directory and observe the file system using this command:

```
rsync original/
```

### <span class="ez-toc-section" id="bkmrk--8"></span>Most Common rsync Commands

One of the most essential use cases for **rsync** is to replicate data between two directories within the same system. To do this, use the following command:

```
rsync original/* duplicate/
```

The contents inside the **original** directory will be mirrored in the **duplicate** directory. If you add a new file or update existing files in the **original** directory, only the new or changed files will be transferred. However, if the **duplicate** folder doesn’t exist, it will result in an error.

To synchronize files and create a new folder simultaneously, use this command instead:

```
rsync original/ duplicate/
```

### <span class="ez-toc-section" id="bkmrk--9"></span>How to Use rsync Commands With Subdirectories

To synchronize folders and subdirectories between two locations, use this **rsync** copy directory command:

```
rsync -r original/*/ duplicate/
```

To synchronize a specific subdirectory, type the command below:

```
rsync -r original/subdirectory_name/ duplicate/
```

Replace **subdirectory\_name** with the name of the subfolder you want to synchronize.

You may want to exclude a particular subdirectory from synchronization. In this case, enter the following command to do it:

```
rsync -r --exclude=subdirectory_name original/ duplicate/
```

### <span class="ez-toc-section" id="bkmrk--10"></span>How to Synchronize Files

To sync or update files between two folders, use this command:

```
rsync -av original/ duplicate/
```

To copy the files from the **original** directory to a remote server, enter this command:

```
rsync -av -e ssh original/ username@remote_host:/path/to/destination/
```

Replace **username, remote\_host,** and **/path/to/destination/** with the appropriate values.

### <span class="ez-toc-section" id="bkmrk--11"></span>How to Combine rsync Commands

As you become more familiar with **rsync**, let’s explore its capability to combine multiple commands for complex file management tasks.

You can combine synchronization and exclusion features to achieve precise results.

The example below shows how you can synchronize all files from the **original** **rsync** directory while excluding **TXT** files:

```
rsync -av --exclude='*.txt' original/ duplicate/
```

Combine the **-r** option with synchronization commands to ensure that **rsync** directories and their contents are recursively synchronized.

```
rsync -av -r original/ duplicate/
```

Before synchronizing an actual **rsync** folder, you can use the **–dry-run** option to preview the changes **rsync** would make without making any actual modifications.

```
rsync -av --dry-run original/ duplicate/
```

### <span class="ez-toc-section" id="bkmrk--12"></span>Other Options for rsync Commands

The **–delete** option allows you to delete files from the destination directory that no longer exist in the source directory. To use this option, include it in your **rsync** command like this:

```
rsync -av --delete original/ duplicate/
```

**rsync** supports synchronizing specified files or file types using patterns and wildcards. For example, to only synchronize **TXT** files, enter:

```
rsync -av original/*.txt duplicate/
```

You can also exclude files based on specific patterns in their names. To exclude a file named **example.txt**, type the following command:

```
rsync -av --exclude=example.txt original/ duplicate/
```

Combine the **–include** and **–exclude** options to include multiple files or directories while excluding others. Here’s an example to include files beginning with the letter **L** and exclude all the other files:

```
rsync -av --include='L*' --exclude='*' original/ duplicate/
```

To limit synchronization to files below a specific size, use the **–max-size** option followed by the size limit. The **rsync** command to only synchronize files smaller than **10 MB** is as follows:

```
rsync -av --max-size=10M original/ duplicate/
```

### <span class="ez-toc-section" id="bkmrk--13"></span>How to Add a Progress Bar

Monitoring synchronization progress can be helpful, especially for large file transfers. **rsync** allows you to include a progress bar using the **–progress** option. Here’s the command you can employ:

```
rsync -av --progress original/ duplicate/
```

The output will look something like this:

```
file1.txt
    5,120,000 100%   50.00MB/s 0:00:00 (xfr#1, to-chk=2/3)
file2.txt
    5,345,678 100%   55.67MB/s 0:00:00 (xfr#2, to-chk=1/3)
```

To add a progress bar and keep partially transferred files instead of deleting them upon interruption, use the **-P** option:

```
rsync -av -P original/ duplicate/
```

### <span class="ez-toc-section" id="bkmrk--14"></span>How to Create an rsync Backup

Lastly, **rsync** provides a convenient way to create backup files using the **–backup** option. This option lets you back up files to a server, preventing overwriting during synchronization.

To create a remote backup and specify its directory, use the following command:

```
rsync -av --backup --backup-dir=/path/to/backup/ original/ duplicate/
```

When executed, the **rsync** backup option generates an incremental file list and appends a tilde (**~**) to the original file name, such as **important.txt.**

## Conclusion

**rsync** is a powerful remote synchronization, data transfer, and file mirroring tool. In this guide, we’ve covered everything you need to get started with the tool, from installation to practical **rsync** examples you can apply via the command line. Mastering **rsync** will enhance your Linux file management, making it more efficient and reliable.

#### Discover Other Linux Commands for Server Management

[How to Check Disk Space on Linux](https://www.hostinger.com/tutorials/vps/how-to-check-and-manage-disk-space-via-terminal)  
[How to Transfer Data With Curl Command](https://www.hostinger.com/tutorials/curl-command-with-examples-linux/)  
[How to Calculate Process Execution With Time Command](https://www.hostinger.com/tutorials/linux-time-command/)  
[How to Transfer Files Using Scp Command](https://www.hostinger.com/tutorials/using-scp-command-to-transfer-files/)  
[How to Monitor Changes With Watch Command](https://www.hostinger.com/tutorials/linux-watch-command/)  
[How to Shutdown and Restart the Server](https://www.hostinger.com/tutorials/linux-shutdown-command/)  
[How to List Services in Linux](https://www.hostinger.com/tutorials/manage-and-list-services-in-linux)  
[How to Write and Display to File With Tee Command](https://www.hostinger.com/tutorials/linux-tee-command-with-examples/)

## <span class="ez-toc-section" id="bkmrk--15"></span>rsync FAQ

This section will answer the most common questions about **rsync.**

### <span class="ez-toc-section" id="bkmrk--16"></span>What Operating Systems Are Compatible With rsync?

**rsync** is primarily designed for Unix-like operating systems, including Linux and macOS. However, it can also be used on Windows systems with the help of third-party **rsync** client applications like Cygwin or Windows Subsystem for Linux (WSL). This makes **rsync** a versatile choice for file synchronization across various operating systems.

<div class="schema-faq wp-block-yoast-faq-block" id="bkmrk--17" style="text-align: justify;"><div class="schema-faq-section" id="bkmrk--18"></div><div class="schema-faq-section">  
</div></div>### <span class="ez-toc-section" id="bkmrk--19"></span>How Does rsync Differ From Other File Transfer Methods?

Instead of transferring entire file systems, **rsync** only sends the differences between destination and source files, reducing bandwidth usage. It can work over secure SSH connections, offer flexible file compression, and resume interrupted transfers. It’s particularly handy when dealing with a large number of files in a remote system.

<div class="schema-faq wp-block-yoast-faq-block" id="bkmrk--20" style="text-align: justify;"><div class="schema-faq-section" id="bkmrk--21"></div><div class="schema-faq-section">  
</div></div>### <span class="ez-toc-section" id="bkmrk--22"></span>Are There Any Limitations or Drawbacks to Using rsync?

While **rsync** is a powerful tool, it has some limitations. First, it may not be suitable for real-time synchronization as it operates in batch mode. Additionally, it doesn’t provide native encryption, as users often rely on SSH for secure transfers. Lastly, **rsync** can be complex for beginners, requiring a learning curve to master its extensive options.

<div class="schema-faq wp-block-yoast-faq-block" id="bkmrk--23"><div class="schema-faq-section" id="bkmrk--24"></div></div>

# Como recuperar a senha de root no Linux

Link: [https://www.alura.com.br/artigos/como-recuperar-senha-de-root-no-linux](https://www.alura.com.br/artigos/como-recuperar-senha-de-root-no-linux)

Existem algumas maneiras de se recuperar a **senha do usuário administrador (ou do super usuário) no Linux**. Uma muito comum é alterar o modo que o sistema inicia, ou seja, quando realiza o [**boot**](https://pt.wikipedia.org/wiki/Boot). Dessa forma, acessamos o sistema como superusuário e alterar a senha.

Para isso, precisamos antes entender melhor o que seria o boot!

## Entendendo o boot

Boot nada mais é do que o momento em que sua máquina está sendo ligada. Nesse momento, um programa chamado [**BIOS**](https://pt.wikipedia.org/wiki/BIOS) carrega algumas informações sobre o hardware do computador e o checa. Após esse processo ela chama o gerenciador de boot **(boot loader)** que carrega o sistema operacional.

Existem diversos gerenciadores disponíveis. No caso do Linux, esse gerenciador mais comum é o [**GRUB**](https://pt.wikipedia.org/wiki/GNU_GRUB), porém existem [outros](https://en.wikipedia.org/wiki/Comparison_of_boot_loaders).

Utilizando o GRUB nós conseguimos acessar o sistema como superusuário executar alguns comando, como trocar a senhas de usuários.

Mas como consigo acessar o GRUB?

## Acessando o GRUB

Conseguimos acessar o GRUB no momento em que a máquina está ligando. Basta apertar a tecla Esc, ou Shift. Após um tempo, uma tela parecida com está deve aparecer:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_1-3.png)

Queremos falar para o GRUB que desejamos acessar o sistema como usuário administrador, dessa forma conseguimos modificar a senha.

Para dizer isso ao GRUB, temos que editar uma linha em sua configuração. Logo, pressionamos `e` (edit) para editar essas informações:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_2-3.png)

Neste arquivo, o GRUB passa algumas informações (parâmetros) para o [**kernel**](https://pt.wikipedia.org/wiki/N%C3%BAcleo_(sistema_operacional)), isto é, o núcleo do sistema operacional. Algumas dessas informações são: o sistemas de arquivos do root, o tipo de montagem de uma partição, entre outros.

Queremos entrar como super usuário no momento em que o Linux é carregado. Logo, vamos até a linha `linux` para colocar essa configuração:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_3-3.png)

Essa linha nos mostra quando o boot começar.

O GRUB tentará carregar o arquivo do kernel que está em `/boot/vmlinuz-4.8.0-36-generic` como usuário `root` (super usuário), em **modo de leitura** (`ro`, read only), sem escrever na tela (`quiet`), apresentando uma tela de carregamento (`splash`) e o modo gráfico (`$vt_randoff`).

Mas eu quero poder alterar a senha do meu usuário quando o sistema iniciar. Isto é, quero poder escrever as configurações, então vamos alterar a opção **`ro` (read only) para `rw` (read and write)**.

O sistema será acessado via o terminal. Então podemos retirar essas opções que mostram a tela de carregamento e o modo gráfico:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_4-2.png)

Bem, vamos acessar o sistema pelo terminal… Mas qual terminal?

Precisamos dizer para o GRUB iniciar um terminal assim que o sistema carregar, dessa forma conseguiremos realizar as alterações.

Para isso falaremos para ele iniciar (`init`) um [**Shell**](https://pt.wikipedia.org/wiki/Shell_script), como o [**Bash**](https://pt.wikipedia.org/wiki/Bash), um shell muito comum para os sistemas Linux, que está localizado na pasta `bin`:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_5-3.png)

Pronto! Configurações realizadas! Vamos dizer para o sistema iniciar com essas configurações. Para isso nós pressionamos `Ctrl + x` ou simplesmente `F10`.

O sistema irá iniciar com essas configurações em um terminal já logado como super usuário:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_6-3.png)

Agora resta apenas alterar a senha do usuário.

No meu caso vou alterar a senha do usuário administrador `yuri`, então posso dizer para o terminal: "Por favor, altere a senha (`passwd`) do usuário `yuri`":

`passwd yuri`

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_7-3.png)

Vamos informar a nova senha e pronto! Vamos reiniciar o computador para instalar nosso programa. Já que vamos reiniciar a máquina podemos utilizar o comando **`reboot`**:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_8-3.png)

Hum… Deu um erro, não conseguimos reiniciar o computador. :(

Quando estamos como monousuário no GRUB, não conseguimos reiniciar o computador com esses comando como `reboot`.

Então, como podemos reiniciar nosso computador?

Bem, podemos desligá-lo da energia e ligá-lo novamente. Ou, podemos utilizar outro comando.

Existe um comando chamado `init`. Com este comando conseguimos mudar o nível de execução do sistema. Isto é, podemos desligá-lo, reiniciá-lo, entre outras coisas.

Cada nível possui um [**código**](https://www.lifewire.com/how-to-use-the-init-command-in-linux-4066930), como por exemplo o nível 6, que reinicia o sistema.

Já que queremos reiniciar o sistema, vamos falar para o `init` fazer isso para a gente:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_9-2.png)

Humm… outro erro. O sistema não conseguiu se comunicar com o comando desta forma. Vamos tentar passar o caminho até o local onde o comando está localizado para conseguir executá-lo.

Queremos executar (`exec`) o comando `init`, que está localizado na pasta `/sbin/init`, passando como parâmetro o nível 6 (reiniciar):

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_10-2.png)

Quando o computador reiniciar podemos usar essa nova senha para instalar o Docker:

![](https://www.alura.com.br/artigos/assets/uploads/2017/10/image_11-2.png)

Funcionou! Conseguimos alterar a senha com sucesso.

## Para saber mais

Neste caso, eu utilizei o GRUB para mudar a senha do usuário administrador do sistema, mas poderia ter usado para modificar a senha do superusuário (root).

Essas mudanças feitas no GRUB são temporárias. Isto é, só valem na vez que foram configuradas no boot. Caso queira que as mudanças sejam permanentes é necessário alterar o arquivo do GRUB.

Esse é apenas um dos muitos jeitos de recuperar a senha do usuário administrador ou do usuário root no Linux. Além desse, outro muito utilizado é usando um **pendrive inicializável com um sistema operacional**. Dessa forma conseguimos montar uma partição e utilizá-la para alterar as senhas.

Veja que conseguimos acessar o sistema como root apenas com uma configuração no gerenciador de boot. Isso pode ser muito perigoso caso alguém com más intenções tenha acesso a máquina. Por isso existem algumas formas de [**proteger**](https://www.vivaolinux.com.br/artigo/GRUB-e-a-senha-de-root-como-atacar-e-proteger-seu-sistema?pagina=2) o GRUB desse tipo de ataque.

Nós acessamos o sistema como super usuário, por isso, **cuidado!** Caso não tenha certeza do que um comando faz, não o execute.

# Como acessar a partição e os dados do Linux EXT4 no Windows 11/10/8/7 [2024 atualizado]

Link: [https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html)

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk-perguntas-frequentes" style="text-align: justify;"><div class="side_article_22222 current"><div class="side_big"><div class="box_all"><div class="box"><div class="list"></div></div></div></div></div></div><div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--3" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="user_2024416_w"><div class="author"></div></div></div></div></div></div></div></div>Escrito por [Jacinta](https://br.easeus.com/author/jacinta.html) Atualizado em 23/07/2024

Nesta página, você revelará 6 métodos práticos para acessar a partição EXT4 do Windows 11/10/8/7 em duas partes. Siga para saber como acessar e ler dados de partição Linux EXT4 no Windows com facilidade:

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk-conte%C3%9Ado-da-p%C3%81gina%3A-" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="mb_2018_no1"><span class="t">CONTEÚDO DA PÁGINA:</span><dl><dt>[Parte 1. Posso ler ext4 no Windows](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html#part1)</dt><dt>[Parte 2. Como acessar dados EXT4 do Windows 11/10/8/7](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html#part2)</dt><dt>[Parte 3. Como montar EXT4 no Windows 11/10/8/7](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html#part3)</dt></dl></div></div></div></div></div></div></div>Se você estiver inicializando o Windows e o Linux em dual-boot em seu notebook ou computador desktop, você provavelmente pode querer acessar arquivos em sua partição Linux como EXT4 no Windows em algum momento. Confira como acessar e abrir arquivos de partição EXT4 no seu PC com Windows com facilidade.

## Parte 1. Posso ler EXT4 no Windows

*"Olá, recentemente mudei meu antigo disco rígido do computador Linux para meu laptop Windows 10 atual. Estou pensando em usar o disco rígido Linux como uma unidade de dados. Alguém sabe como ler e acessar a partição EXT4 do Windows 10?"*

Você está tendo um problema semelhante que não pode acessar nem montar uma partição Linux EXT4 no Windows 10/8/7? Para fazer isso, você precisará primeiro descobrir as duas perguntas a seguir:

**1. O que é EXT4?**

EXT4, conhecido como o quarto sistema de arquivos estendido, o sucessor do EXT3, é um dos sistemas de arquivos mais recentes usados pelos usuários do Linux. É o sistema de arquivos padrão para muitas distribuições Linux, incluindo Debian e Ununtu.

**2. O Windows 10 ou Windows 8/7 pode ler EXT4?**

Embora o EXT4 seja o sistema de arquivos Linux mais comum, ele não é compatível com o Windows por padrão. Portanto, a resposta para "o Windows pode ler EXT4" é não. Você pode facilmente visitar uma partição Windows NTFS do Linux. No entanto, o Windows não pode ler partições do Linux diretamente.

Mas isso não significa que não há como abrir ou acessar o EXT4 a partir do Windows. Para fazer isso, você precisará de ferramentas e resoluções de terceiros para obter ajuda.

Continue lendo e siga os métodos fornecidos na Parte 2 e na Parte 3, você aprenderá como acessar e ler dados de partição Linux EXT4 no Windows.

## Parte 2. Como acessar o Ext4 no Windows 11/10/8/7

Nesta parte, você aprenderá:

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk-1.-uma-maneira-r%C3%A1pid" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text">1. 1. Uma maneira rápida de visualizar o conteúdo da partição EXT4;
2. 2. Como acessar os dados da partição EXT4 e torná-los acessíveis pelo Windows.

</div></div></div></div></div></div>Para usar o disco rígido Linux como um disco de dados no Windows, tornando a partição EXT4 acessível no Windows, você precisará primeiro verificar se há dados importantes salvos na unidade usando uma ferramenta de visualização EXT4.

Se você salvou dados importantes, pode aplicar um leitor EXT4 confiável para acessar e restaurar dados da partição. Então você pode formatar e converter a partição EXT4 para NTFS com um formatador EXT4 profissional. Nenhuma perda de dados ocorrerá.

Passe pelo processo completo a seguir e você tornará o EXT4 acessível no Windows 11/10/8/7:

Observe que, se você não se importa com os dados, vá para o formatador EXT4 em #2 para obter ajuda.

### \#1. Visualize e leia o conteúdo da partição EXT4

**Aplica-se a:** Visualizar conteúdo e dados da partição EXT4 no Windows

**Ferramenta importante:** [software gerenciador de partição](https://br.easeus.com/partition-manager/partition-master.html) Linux EXT4 - EaseUS Partition Master

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk-baixar-gr%C3%A1tis%C2%A0-1" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="button_box box_211222"><div class="inline-block">[Baixar Grátis<span class="arrow"> </span>](https://down.easeus.com/product/epm_trial?ref=https%3A%2F%2Fbr.easeus.com%2Fpartition-manager-tips%2Facessar-ext4-windows.html)</div></div></div></div></div></div></div></div>**Windows 11/10/8/7**100% Seguro

Antes de começar a converter ou acessar a partição EXT4 do Windows, é essencial visualizar e verificar o conteúdo salvo no volume. Aqui, gostaríamos de recomendar que você experimente o software gerenciador de partição EXT4 confiável - EaseUS Partition Master.

Etapa 1. Inicie o EaseUS Partition Master, localize a partição EXT4.

Etapa 2. Clique com o botão direito do mouse na partição EXT4 e selecione "Propriedades".

Etapa 3. Abra e expanda as pastas no painel esquerdo para verificar o conteúdo da partição EXT4.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--4" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="img_box_pop pop_img">![Explore partição com EaseUS Partition Mater](https://www.easeus.com/images/en/screenshot/partition-manager/screenshots/explore-partition-2.png)</div></div></div></div></div></div></div>Se a partição Linux EXT4 contiver alguns arquivos valiosos, passe para a próxima fase e você aprenderá como acessar e recuperar dados de uma partição Linux no Windows.

### \#2. Acesse dados de partição EXT4 do Windows 11/10/8/7

**Aplica-se a:** Ler e acessar dados da partição EXT no Windows, tornando a partição EXT4 acessível ao formatar EXT4 para NTFS.

**Ferramentas importantes:** 1. Leitor EXT4; 2. Ferramenta de formatação EXT4.

Para evitar problemas desnecessários de perda de dados, antes de converter a partição EXT4, sugerimos que você aplique um leitor EXT4 confiável para acessar os dados salvos antecipadamente. Siga para tornar a partição EXT4 acessível sem perder nenhum dado:

**Primeiro. Use o leitor EXT4 para ler e restaurar dados de partição EXT4**

Então, como recuperar dados da partição EXT4 inacessível no Windows? Você precisará de um leitor EXT4 confiável para obter ajuda. O EaseUS Data Recovery Wizard, como um [software de recuperação de dados de disco rígido](https://br.easeus.com/data-recovery-software/data-recovery-wizard.html) profissional, é capaz de ajudar.

Observe que, se você perdeu ou excluiu dados em outros tipos de dispositivos de armazenamento, como partições EXT2/EXT3, unidade USB FAT32 ou disco rígido externo exFAT, este software verificará rapidamente e restaurará tudo o que você perdeu imediatamente.

Aqui, você pode aplicar este software para digitalizar, visualizar e restaurar tudo salvo na partição EXT4 em apenas 3 etapas:

**Passo 1. Inicie o software de recuperação de disco rígido EaseUS.**

Execute o EaseUS Data Recovery Wizard no seu PC e selecione a unidade no seu disco rígido onde você perdeu ou excluiu arquivos. Clique em "Procurar Dados Perdidos" e deixe este programa verificar todos os dados e arquivos perdidos no disco rígido selecionado.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--5" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="globle_img_bg"><div class="img_box_pop pop_img">![selecione a unidade no seu disco rígido](https://br.easeus.com/images/br/seo/recover-data-step1.png)</div></div></div></div></div></div></div></div>**Passo 2. Verifique e visualize todos os dados perdidos do disco rígido.**

Encontre dados perdidos do disco rígido em "Arquivos Excluídos", "Arquivos Perdidos" ou use "Filtro" para navegar rapidamente pelos dados perdidos. Marque e clique duas vezes para visualizar esses arquivos encontrados.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--6" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="globle_img_bg"><div class="img_box_pop pop_img">![selecione a unidade no seu disco rígido passo 2](https://br.easeus.com/images/br/seo/recover-data-step2.png)</div></div></div></div></div></div></div></div>**Passo 3. Restaure os dados perdidos do disco rígido em um local seguro.**

Após a visualização, selecione os arquivos desejados que você perdeu na unidade e clique em "Recuperar" para salvá-los. Navegue para escolher um local seguro no seu PC ou em outros dispositivos de armazenamento externo para armazenar esses dados restaurados do disco rígido.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--7" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="globle_img_bg"><div class="img_box_pop pop_img">![selecione a unidade no seu disco rígido passo 3](https://br.easeus.com/images/br/seo/recover-data-step3.png)</div></div></div></div></div></div></div></div>Lembre-se de salvar os dados da partição EXT4 restaurada em outro local seguro no disco rígido do Windows.

**Próximo. Use o formatador EXT4 para tornar a partição EXT4 acessível no Windows**

Como você sabe, o Windows não oferece suporte ao acesso a partições de sistema de arquivos baseadas em Linux, o que, como resultado, os usuários do Windows não podem visualizar nem fazer alterações nas partições EXT4/3/2 no PC com Windows.

A maneira mais fácil que você pode tentar é alterar o sistema de arquivos da partição Linux de EXT4/3/2 para um compatível com o Windows - NTFS ou FAT32, tornando uma partição EXT4/3/2 acessível no Windows. Aqui, recomendamos que você experimente um formatador EXT4 confiável - EaseUS Partition Master para obter ajuda.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk-baixar-gr%C3%A1tis%C2%A0-2" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="button_box box_211222"><div class="inline-block">[Baixar Grátis<span class="arrow"> </span>](https://down.easeus.com/product/epm_trial?ref=https%3A%2F%2Fbr.easeus.com%2Fpartition-manager-tips%2Facessar-ext4-windows.html)</div></div></div></div></div></div></div></div>**Windows 11/10/8/7**100% Seguro

Você pode converter facilmente uma partição EXT4 para NTFS com apenas alguns cliques simples, formatando:

**Etapa 1.** Inicie o EaseUS Partition Master, clique com o botão direito do mouse na partição que deseja formatar e escolha "Formatar".

**Etapa 2.** Na nova janela, insira o rótulo da partição, escolha o sistema de arquivos FAT32/EXT2/EXT3/EXT4 e defina o tamanho do cluster de acordo com suas necessidades e clique em "OK".

**Etapa 3.** Em seguida, você verá uma janela de aviso, clique em "OK" para continuar.

**Etapa 4.** Clique no botão "Executar operação" no canto superior esquerdo para revisar as alterações e clique em "Aplicar" para iniciar a formatação da partição para FAT32/EXT2/EXT3/EXT4.

[https://youtu.be/qQjVlBV7SJY](https://youtu.be/qQjVlBV7SJY)

[![image.png](https://capacita.siteinternet.com.br/uploads/images/gallery/2024-07/scaled-1680-/image.png)](https://capacita.siteinternet.com.br/uploads/images/gallery/2024-07/image.png)

**Você também pode gostar de:**

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--9" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="modular_box_1216 clearfix amp_module_box">![artigos relacionados](https://br.easeus.com/images_2019/article/star.png)<div class="word">  
</div></div></div></div></div></div></div></div>Como particionar o disco rígido no Windows 10

Depois de formatar a partição EXT4 para um sistema de arquivos normal, você também pode reparticionar o volume. Siga para saber como particionar um disco rígido por conta própria.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--10" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="modular_box_1216 clearfix amp_module_box"><div class="word">  
</div><div class="img amp_none">![Gerenciar partições](https://www.easeus.com/images/en/screenshot/partition-manager/partition-windows-10-free-4.png)</div></div></div></div></div></div></div></div>## Parte 3. Como montar EXT4 no Windows 11/10/8/7

Nesta parte, você aprenderá: Como montar a partição EXT4 no Windows, acessando arquivos EXT4 do Windows usando software de terceiros.

Se você pretende manter o Linux com Windows no computador, acessando arquivos EXT4 do Windows, você pode tentar montar a partição EXT4 no Windows 11/10/8/7. Mas como faço para montar uma unidade Linux no Windows 10?

Se você está com a mesma dúvida em mente, fique aqui. Nesta parte, apresentaremos a você 3 leitores Linux confiáveis, ajudando você a montar EXT4 no Windows 11/10/8/7:

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk-%231.-ext2fsd-%232.-disk" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text">1. [\#1. EXT2Fsd](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html#1)
2. [\#2. DiskInternals Linux Reader](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html#2)
3. [\#3. Ext2explore](https://br.easeus.com/partition-manager-tips/acessar-ext4-windows.html#3)

</div></div></div></div></div></div>Pegue uma ferramenta e siga os tutoriais abaixo para montar o EXT4 em seu computador Windows agora:

### \#1. Montar EXT4 no Windows usando Ext2Fsd

Ext2Fsd é um driver de sistema de arquivos do Windows, projetado para sistema de arquivos EXT4/3/2. Ele permite que usuários do Windows leiam e acessem sistemas de arquivos Linux como EXT4 montando a partição EXT4 no Windows.

Aqui estão as etapas:

Etapa 1. Instale e inicie o driver Ext2Fsd no seu PC com Windows.

Etapa 2. Vá para Ferramentas &gt; Gerenciamento de serviços &gt; Inicie o serviço Ext2Fsd antes de acessar os arquivos do Linux.

Etapa 3. Marque as caixas "Montar todos os volumes no modo somente leitura" e "Atribuir letra de unidade automaticamente" e clique em "Aplicar".

![Montar EXT4 no Windows via Ext2Fsd](https://www.easeus.com/images/en/screenshot/partition-manager/mount-ext4-on-windows-via-ext2fsd.jpg)

Depois disso, você pode encontrar suas partições EXT4 com suas próprias letras de unidade no Windows Explorer. Você pode até acessar diretamente os arquivos na partição EXT4.

### \#2. Montar a partição EXT4 no Windows 10 via DiskInternals Linux Reader

[DiskInternals Linux Reader](https://www.diskinternals.com/linux-reader/) suporta sistema de arquivos EXT4, ReFS, HFS e HFS+. Ao contrário do Ext2Fsd, o DiskInternals Linux Reader permite que os usuários do Windows visitem e naveguem nas partições do Linux dentro deste aplicativo.

Etapa 1. Instale e inicie o DiskInternals Linux Reader no Windows PC.

Etapa 2. Localize a partição EXT4 neste aplicativo.

![Abra DiskInternals Linux Reader](https://www.easeus.com/images/en/screenshot/partition-manager/mount-ext4-on-windows-via-diskinternal-linux-reader-1.jpg)

Etapa 3. Clique duas vezes para abrir a partição EXT4, visualizar e verificar os dados salvos na partição.

![Acessar dados de partição EXT 4 via DiskIntrnals Linux Reader](https://www.easeus.com/images/en/screenshot/partition-manager/mount-ext4-on-windows-via-diskinternal-linux-reader-2.jpg)

Etapa 4. Para usar os arquivos na partição EXT4, selecione os arquivos e clique em "Salvar" para armazená-los em outro local seguro no seu PC Windows.

### \#3. Montar EXT4 no Windows usando Ext2explore

[Ext2explore](https://sourceforge.net/projects/ext2read/) é um aplicativo de código aberto que funciona de forma semelhante ao DiskInternals Linux Reader. Ele permite que os usuários acessem o conteúdo da partição EXT4 apenas neste aplicativo.

Aqui estão as etapas que você pode aplicar para acessar o EXT4 do Windows via Ext2explore:

Etapa 1. Baixe o Ext2explore.ext e execute este programa no Windows PC.

Etapa 2. Uma vez iniciado, clique com o botão direito do mouse e selecione "Executar como administrador".

Você também pode clicar com o botão direito do mouse em ext2explore.exe e selecionar "Propriedades" &gt; Compatibilidade &gt; Marque "Executar este programa como administrador" &gt; "OK".

![Abrir Ext2Explore](https://www.easeus.com/images/en/screenshot/partition-manager/mount-ext4-on-windows-via-ext2explore-1.jpg)

Etapa 3. Depois disso, você pode navegar pela partição Linux EXT4 e seu conteúdo.

Para usar os arquivos, clique com o botão direito do mouse nos arquivos e selecione "Salvar" &gt; Navegue em outro local seguro para salvar os arquivos no computador Windows.

![Acessar dados da partição EXT4 via Ext2Explore](https://www.easeus.com/images/en/screenshot/partition-manager/mount-ext4-on-windows-via-ext2explore-2.jpg)

## Conclusão

Nesta página, você aprendeu o que é EXT4 e duas maneiras diferentes de acessar e abrir a partição EXT4 no Windows.

Para usar a partição Linux EXT4 como uma unidade de dados no Windows, você precisará exportar e restaurar os dados da partição EXT4 primeiro usando o EaseUS Data Recovery Wizard. Em seguida, converta a partição EXT4 em um sistema de arquivos reconhecido pelo Windows - NTFS ou FAT32 formatando via EaseUS Partition Master.

Para manter o Linux e o Windows em seu computador e acessar os arquivos EXT4 do Windows, você precisará montar a partição do Linux no Windows. Para fazer isso, você pode tentar as ferramentas recomendadas para obter ajuda. Para a maneira mais direta, sugerimos que você experimente o Ext2Fsd.

Se você tiver mais dúvidas sobre sistemas de arquivos EXT4 ou Linux, verifique as perguntas frequentes abaixo, você pode obter a resposta desejada.

### Perguntas Frequentes

1\. O Windows pode ler ext4?

Os sistemas operacionais Windows não são compatíveis com o sistema de arquivos Linux, incluindo EXT4. Como resultado, o Windows não pode ler ou detectar diretamente uma partição ou dispositivo EXT4. Mas se você quiser acessar o EXT4 do Windows, tente os métodos listados nesta página. Você tornará isso possível.

2\. Qual é melhor, NTFS ou EXT4?

Como NTFS e EXT4 são dois sistemas de arquivos diferentes projetados para dois sistemas operacionais, para testar o desempenho, você precisará fazer isso no sistema operacional nativo.

Conforme testado, o NTFS é muito mais rápido que o EXT4 no Windows. Além disso, se estiver no Linux, o EXT4 é mais rápido que o NTFS.

3\. O Windows pode gravar em EXT4?

Na verdade, se você estiver executando o Windows e o Linux no mesmo PC, é impossível acessar o EXT4 no Windows, o que, como resultado, você não pode fazer nada em uma partição EXT4 ou dispositivo de armazenamento.

Em uma palavra, o Windows não pode gravar em EXT4. Se você realmente precisa escrever coisas em EXT4 no sistema operacional Windows, precisará primeiro converter EXT4 em um dispositivo baseado em sistema de arquivos NTFS ou FAT32. Você pode executar o EaseUS Partition Master com seu recurso Formatar para obter ajuda, conforme mostrado nesta página na Parte 2.

<div class="article_new_content3 padt RobotoRegular epm_new" id="bkmrk--16" style="text-align: justify;"><div class="wrap_1000"><div class="article_new_content_left center3"><div class="padding_box"><div class="word_content"><div class="word_content_text"><div class="button_box box_211222">  
</div></div></div></div></div></div></div>4\. Como faço para abrir uma unidade Linux no Windows?

Sendo semelhante às formas mostradas nesta página, para abrir uma unidade Linux no Windows, você pode tentar alterar seu sistema de arquivos para NTFS/FAT32 ou montar a unidade Linux no Windows.

Se você preferir alterar o sistema de arquivos da unidade Linux para torná-lo legível e gravável, formate-o em NTFS ou FAT32 com as soluções da Parte 2 nesta página.

Se você quiser apenas visitar ou acessar arquivos salvos na unidade Linux a partir do Windows, monte-o no Windows usando os aplicativos recomendados na Parte 3.

# Como Acessar Arquivos do Linux Pelo Windows 10 [Guia Completo]

Link: [https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html](https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html)

<header class="container article-header" id="bkmrk-"><div class="article-info"></div></header>O que é um sistema de arquivos Linux? Posso ler uma unidade Linux pelo Windows? Como faço para acessar arquivos do Linux pelo Windows 10? Muitos usuários procuram respostas para estas perguntas. Nesse artigo, a [MiniTool](https://www.minitool.com/pt/) vai analisar cada uma delas com você.

<div class="container article-body" id="bkmrk-navega%C3%A7%C3%A3o-r%C3%A1pida-%3A-o" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><nav class="article-nav js-article-nav"><span class="nav-title">Navegação rápida :</span>- [O Que é o Sistema de Arquivos Linux](https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html#o-que-%C3%A9-o-sistema-de-arquivos-linux-18579)
- [Posso Acessar Arquivos do Linux pelo Windows 10?](https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html#posso-acessar-arquivos-do-linux-pelo-windows-10?-18579)
- [Como Acessar Arquivos do Linux no Windows 10](https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html#como-acessar-arquivos-do-linux-no-windows-10-18579)
- [Qual a Sua Opinião?](https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html#qual-a-sua-opini%C3%A3o?-18579)
- [Perguntas Frequentes – Como Acessar Arquivos do Linux pelo Windows 10](https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html#perguntas-frequentes-%E2%80%93-como-acessar-arquivos-do-linux-pelo-windows-10-18579)

</nav></div></div></div>Se você utiliza uma distribuição Linux juntamente com um sistema Windows no seu notebook ou desktop, pode ser necessário acessar os arquivos Linux pelo Windows 10. Após analisarmos inúmeros relatos de usuários em fóruns, concluímos que as seguintes perguntas são feitas com maior frequência. Na parte seguinte, vamos explorá-las em detalhes.

## O Que é o Sistema de Arquivos Linux

Para acessar arquivos Linux pelo Windows com sucesso, a primeira coisa que você deve saber é qual sistema de arquivos é suportado pelo Linux. Os [Sistemas de Arquivos Linux](https://www.partitionwizard.com/partitionmagic/linux-file-system.html) mais comuns são Ext2, Ext3 e Ext4.

Atualmente, o Ext4 se tornou o sistema de arquivos padrão para a maioria das distribuições Linux, incluindo Debian e Ubuntu. Isso ocorre porque o Ext4 oferece mais flexibilidade para armazenar arquivos grandes do que outros sistemas de arquivos estendidos. Segundo o fabricante, o Ext4 pode suportar o armazenamento de um arquivo de até 16 TB e a criação de uma partição de até 1 EB.

## Posso Acessar Arquivos do Linux pelo Windows 10?

Muitos usuários têm máquinas que utilizam o Windows 10 e o Linux com inicialização dupla (*dual boot*) ou discos rígidos formatados em Ext4. Então, aqui vem uma nova pergunta. Posso acessar arquivos do Linux pelo Windows 10? Como discutido acima, o sistema de arquivos Linux mais comum é o Ext4. Ou seja, você precisa ler o Ext4 no Windows se quiser acessar os arquivos do Linux.

No entanto, o sistema de arquivos Ext4 não é suportado pelo Windows. Ao clicar com o botão direito do mouse na partição Ext4, você verá que os menus **Abrir** e outras funções ficam acinzentados. Obviamente, você não poderá acessar os arquivos do Ubuntu diretamente no Windows. O que fazer quando você precisar ler uma unidade Linux no Windows? Por favor, continue lendo a parte a seguir.

![não consigo ler partição Linux Windows 10](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-1.png)

## Como Acessar Arquivos do Linux no Windows 10

Como o Windows 10 não oferece nenhum método direto para acessar Ext4, você precisa utilizar algumas ferramentas profissionais para acessar arquivos do Linux pelo Windows. Aqui, resumimos os 4 melhores leitores de partição Ext4 no Windows.

### 1º Método. Use o MiniTool Partition Wizard Para Ler a Partição Ext4

O MiniTool Partition Wizard é um gerenciador de partições completo que suporta muitos sistemas de arquivos, incluindo FAT16/32, NTFS, exFAT, Ext2/3/4 e Linux Swap. Com este poderoso software, você pode [formatar um disco rígido](https://www.partitionwizard.com/partitionmanager/how-to-format-a-hard-drive.html), converter NTFS em FAT, [converter MBR em GPT](https://www.minitool.com/pt/particao-disco/converter-mbr-em-gpt-apaga-todas-as-particoes.html), recuperar dados perdidos, [migrar SO para SSD/HD](https://www.minitool.com/pt/particao-disco/transferir-windows-10.html), reconstruir o MBR e muito mais.

[<span class="article-down-btn-text">MiniTool Partition Wizard FreeClique para baixar</span><span class="article-down-btn-text feature">100%Limpo e seguro</span>](https://cdn2.minitool.com/?p=pw&e=pw-free)

Para acessar o Ext4 no Windows sem problemas, você pode torná-lo acessível formatando-o como NTFS. Embora a formatação exclua os dados do disco rígido, o MiniTool pode ajudá-lo a restaurar os dados da partição Ext4 para que você possa acessar os arquivos do Linux pelo Windows 10.

**Parte 1. Leia a Unidade Linux no Windows**

Siga as etapas abaixo para formatar a partição Ext4 como NTFS ou outros sistemas de arquivos suportados pelo Windows 10.

**Passo 1.** Inicie o MiniTool Partition Wizard para entrar em sua interface principal e, em seguida, clique com o botão direito do mouse na partição **Ext4** no mapa de disco e selecione **Formatar**.

![selecione Formatar no MiniTool Partition Wizard](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-2.png)

**Passo 2.** Na janela pop-up, selecione **NTFS** no menu suspenso e clique em **OK** para continuar.

**Passo 3.** Clique no botão **Aplicar** para executar a operação.

![formate Ext4 para NTFS usando o software MiniTool](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-3.png)

**Parte 2: Restaure os Dados da Partição Ext4**

Agora, é preciso tornar o Ext4 acessível no Windows 10. No entanto, antes de proceder, você deve querer saber como recuperar os dados da partição formatada. O MiniTool Partition Wizard também pode ser usado para restaurar os dados da partição Ext4. Continue lendo.

<div class="container article-body" id="bkmrk-dicas%3A" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box tip"><div class="icon icon-awe-tip">**Dicas:**</div><div class="content">  
</div></div></div></div></div>**Dica:** O MiniTool Partition Wizard Free Edition não oferece suporte à recuperação de dados. Você precisa instalar uma edição profissional ou uma edição mais avançada para recuperar a partição perdida.

**Passo 1.** Na interface principal, selecione a partição que você acabou de formatar para NTFS e clique em **Recuperação de Partição** na barra de ferramentas superior. Clique em **Avançar** na janela pop-up.

![clique em Recuperação de Partição](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-4.png)

**Passo 2.** Escolha um intervalo de verificação com base em suas necessidades. Existem 3 opções de intervalos para verificar o disco, incluindo **Disco Inteiro, Espaço Não-Alocado** e **Intervalo Específico**. Aqui, usaremos **Disco Inteiro** como exemplo e clicamos em **Avançar** para continuar.

![determinar o Alcance de Varredura](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-5.png)

**Passo 3.** Selecione um método de verificação para fazer a varredura do disco e clique em **Avançar** para continuar.

![selecione um método de escaneamento](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-6.png)

**Passo 4.** Certifique-se de verificar todas as partições, incluindo partições existentes e partições excluídas/formatadas. Aguarde algum tempo até que a verificação seja concluída e clique no botão **Concluir**.

![selecione todas as partições na lista e clique em Concluir](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-7.png)

**Passo 5.** Clique no botão **Aplicar** para recuperar a partição formatada no disco rígido.

![clique em Aplicar para recuperar partições perdidas](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-8.png)

Agora, a partição formatada deve ser recuperada. Em seguida, você pode ler a partição Linux no Windows 10 e acessar seus arquivos.

Além disso, você pode experimentar mais outros três utilitários para acessar o Ext4 pelo Windows 10. Continue lendo!

### 2º Método. Use o Ext2Fsd

[Ext2Fsd](https://sourceforge.net/projects/ext2fsd/) é um driver de sistema de arquivos do Windows que suporta os sistemas de arquivos Ext2/3/4. Ele permite que você leia a partição Linux no Windows 10 e acesse os arquivos do Ubuntu montando a partição Ext4 e atribuindo uma letra de unidade. Você pode configurar o Ext2Fsd para abrir a cada inicialização ou apenas abri-lo quando precisar.

Para acessar o Ext4 no Windows, siga as etapas abaixo:

**Passo 1.** Instale esta ferramenta no seu PC com Windows 10 e inicie o driver.

<div class="container article-body" id="bkmrk-observa%C3%A7%C3%A3o%3A" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box note"><div class="icon icon-awe-note">**Observação:**</div><div class="content">  
</div></div></div></div></div>**Observação:** Se você não quiser iniciar o software automaticamente a cada inicialização, não marque a caixa de seleção **Iniciar Ext2Fsd automaticamente quando o sistema for inicializado**.

![instalar Ext2Fsd no Windows 10 PC](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-9.png)

**Passo 2.** Na interface principal do Ext2Fsd, navegue até a aba **Ferramentas** e selecione **Gerenciamento de Serviço** no menu de contexto.

<div class="container article-body" id="bkmrk-dicas%3A-1" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box tip"><div class="icon icon-awe-tip">**Dicas:**</div><div class="content">  
</div></div></div></div></div>**Dica:** Se você não configurou o Ext2Fsd para iniciar automaticamente na inicialização, vá até **Ferramentas &gt; Gerenciamento de Serviço &gt; Iniciar serviço Ext2Fsd** antes de acessar os arquivos do Linux no Windows 10.

![selecione Ferramentas e inicie o serviço Ext2Fsd](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-10.png)

**Passo 3.** Na janela **Gerenciamento de Serviço do Ext2Fsd**, marque as caixas de seleção para **Montar todos os volumes no modo somente leitura** e **Atribuir letra da unidade automaticamente**. Em seguida, clique em **Aplicar** para executar a operação. Depois disso, essa ferramenta montará e atribuirá automaticamente as letras de unidade às partições do Linux.

![Monte todos os volumes no modo somente leitura Ext2Fsd](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-11.png)

**Passo 4.** Pressione as teclas **Win + E** para abrir o **Explorador de Arquivos**. Você perceberá que as partições Ext4 estão montadas com suas próprias letras de unidade e você pode acessar diretamente os arquivos do Ubuntu pelo Windows.

### 3º Método. Use o DiskInternals Linux Reader

[DiskInternals Linux Reader](https://www.diskinternals.com/linux-reader/) é um utilitário gratuito para acessar arquivos do Linux pelo Windows 10. Esta ferramenta suporta o sistema de arquivos Ext4 além de [ReFS](https://www.minitool.com/lib/resilient-file-system-020.html), HFS e sistemas de arquivos HFS+. Diferente do Ext2Fsd, este programa permite que você leia o drive Linux no Windows dentro do próprio aplicativo.

**Passo 1.** Instale o DiskInternals Linux Reader no seu PC Windows e inicie o programa para entrar na interface principal.

**Passo 2.** Depois que o Linux Reader detectar todas as partições em seu disco rígido, navegue até a partição **Ext4** na lista de unidades.

**Passo 3.** Clique duas vezes na partição **Ext4** para abri-la e visualizar/acessar os dados salvos na unidade.

**Passo 4.** Se você quiser fazer uso total dos arquivos do Linux no Windows, será necessário transferir os arquivos da partição Ext4 para outro local compatível com o sistema de arquivos do Windows. Para isso, clique com o botão direito do mouse no arquivo que você precisa e clique em **Salvar** no menu de contexto.

![clique em Salvar no DiskInternals Linux Reader](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-12.png)

**Passo 5.** Selecione a opção **Salvar Arquivos** e clique no botão **Avançar**.

![salve os arquivos em outro local DiskInternals](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-13.png)

**Passo 6.** Clique no botão **Procurar** para selecionar um local onde você salvará o arquivo e clique em **OK**. Depois, clique em **Avançar**. Aguarde algum tempo até que o arquivo seja salvo no local selecionado.

![selecione um local para salvar os arquivos](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-14.png)

### 4º Método. Use o Ext2explore

[Ext2explore](https://sourceforge.net/projects/ext2read/) é um aplicativo explorador prático para acessar arquivos Ext2/3/4 no Windows 10. Ele funciona de forma semelhante ao DiskInternals Linux Reader, mas não permite visualizar arquivos. Este utilitário não precisa ser instalado, e você pode executar o arquivo .exe diretamente.

Lembre-se de que você deve executar o programa Ext2explore.exe como administrador ou receberá uma mensagem de erro.

**Passo 1.** Clique com o botão direito do mouse no arquivo **Ext2explore.exe** que você baixou no PC Windows e selecione **Executar como administrador**.

<div class="container article-body" id="bkmrk-dicas%3A-2" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box tip"><div class="icon icon-awe-tip">**Dicas:**</div><div class="content">  
</div></div></div></div></div>**Dica:** Se preferir, você pode clicar com o botão direito do mouse em **Ext2explore.exe** e selecionar **Propriedades**. Em seguida, vá para a aba **Compatibilidade** e marque a caixa de seleção **Executar este programa como administrador &gt; OK**.

![execute o Ext2explore como administrador](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-15.png)

**Passo 2.** Agora você pode acessar a partição Ext4 e seus arquivos Linux. Para abrir os arquivos no sistema Windows, você precisa salvá-los na partição do Windows. Clique com o botão direito do mouse no arquivo, selecione **Salvar** e navegue para outro local para salvar os arquivos no sistema Windows.

![clique em Salvar no Ext2explore](https://images.minitool.com/minitool.com/images/uploads/pt/articles/2022/12/accessar-arquivos-linux-pelo-win10/accessar-arquivos-linux-pelo-win10-16.png)

[<span class="article-inner-twitter-boxbtn-text">Eu uso o Windows 10 e o Linux um sistema de inicialização dupla. Embora a distribuição Linux tenha suporte interno para partição NTFS do Windows, o Windows não pode ler a unidade Linux. Felizmente, encontrei 4 métodos eficazes para acessar arquivos do Linux pelo Windows 10. Esse post também pode ser útil para você.</span><span class="article-click-to-twitter icon-awe-twitter">Clique para tweetar</span>](https://twitter.com/intent/tweet?url=https://www.minitool.com/pt/particao-disco/accessar-arquivos-linux-pelo-win10.html&text=Eu+uso+o+Windows+10+e+o+Linux+um+sistema+de+inicializa%C3%A7%C3%A3o+dupla.+Embora+a+distribui%C3%A7%C3%A3o+Linux+tenha+suporte+interno+para+parti%C3%A7%C3%A3o+NTFS+do+Windows%2C+o+Windows+n%C3%A3o+pode+ler+a+unidade+Linux.+Felizmente%2C+encontrei+4+m%C3%A9todos+eficazes+para+acessar+arquivos+do+Linux+pelo+Windows+10.+Esse+post+tamb%C3%A9m+pode+ser+%C3%BAtil+para+voc%C3%AA.&via=MiniTool_)

## Qual a Sua Opinião?

Este post se concentrou principalmente em como acessar arquivos Linux pelo Windows 10. Você pode escolher um dos 4 melhores utilitários mostrados aqui para acessar o Ext4 no Windows. Se tiver boas dicas para compartilhar sobre esse assunto, escreva para a gente na seção de comentários. Além disso, você pode enviar um e-mail para <support@minitool.com> caso tenha alguma dúvida sobre o software MiniTool.

## Perguntas Frequentes – Como Acessar Arquivos do Linux pelo Windows 10

**Como transferir arquivos do Windows para o Linux?**

Após analisar um grande número de relatos e referências de usuários, resumimos os 5 métodos a seguir para transferir arquivos entre Windows e Linux.

<div class="container article-body" id="bkmrk-use-o%C2%A0compartilhamen" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box"><div class="content">1. Use o **Compartilhamento de pastas na rede**.
2. Transfira arquivos do Windows para o Linux por [FTP](https://www.minitool.com/lib/ftp-meaning.html).
3. Copie com segurança os arquivos ou pastas para o Linux usando [SSH](https://www.minitool.com/lib/what-is-ssh.html).
4. Compartilhe os arquivos com um software de sincronização.
5. Use a pasta compartilhada na máquina virtual Linux.

</div></div></div></div></div>**Como montar uma pasta Linux no Windows?**

Aqui estão as etapas detalhadas para montar uma pasta Linux no Windows.

<div class="container article-body" id="bkmrk-pressione-as-teclas%C2%A0" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box"><div class="content">1. Pressione as teclas **Win + E** para abrir o **Explorador de Arquivos** e mapeie sua pasta ou diretório inicial do Linux no Windows.
2. Clique em **Ferramentas** no menu superior e selecione **Mapear unidade de rede**.
3. Selecione a letra da unidade no menu suspenso e clique em **Procurar** para selecionar a pasta que deseja montar.
4. Clique em **Concluir**

</div></div></div></div></div>**Como acessar uma unidade de rede no Linux?**

<div class="container article-body" id="bkmrk-abra-um-terminal-no-" style="text-align: justify;"><div class="article-content"><div class="article-content-block"><div class="article-inner-content-box"><div class="content">1. Abra um terminal no seu Linux, digite **sudo apt-get install smbfs** e pressione **Enter**.
2. Digite a linha **sudo yum install cifs-utils** no terminal e pressione **Enter**.
3. Execute o **sudo chmod u+s /sbin/mount.cifs /sbin/umount.cifs**
4. Use o utilitário **cifs** para mapear uma unidade de rede para armazenamento.

</div></div></div></div></div>**Como acessar uma pasta compartilhada no Linux?**

O método mais simples consiste em pressionar as teclas **Alt + F2** para abrir a caixa de diálogo **Executar** e digitar **smb://** seguido do **endereço IP** do seu servidor Linux e o **nome da pasta**. Em seguida, clique no botão **Executar**.

# Backup com Rsync e Rclone - Shell Script

**Gerado pelo ChatGPT**

Claro! Vou te mostrar um exemplo de shell script que usa `rsync` para fazer backup local e `rclone` para fazer backup em um serviço de armazenamento em nuvem. Esse script é útil para quem deseja manter backups locais e na nuvem com uma única execução.

<span style="background-color: rgb(206, 212, 217);">\### Exemplo de Script de Backup com `rsync` e `rclone`</span>

<span style="background-color: rgb(206, 212, 217);">Este script faz o backup de um diretório local para um local de backup e, em seguida, usa `rclone` para enviar o backup para um serviço de armazenamento em nuvem.</span>

<span style="background-color: rgb(206, 212, 217);">```bash</span>  
**<span style="background-color: rgb(206, 212, 217);">\#!/bin/bash</span>**

**<span style="background-color: rgb(206, 212, 217);">\# Configurações</span>**  
<span style="background-color: rgb(206, 212, 217);">SOURCE\_DIR="/caminho/do/diretorio/origem" # Diretório que você deseja fazer backup</span>  
<span style="background-color: rgb(206, 212, 217);">LOCAL\_BACKUP\_DIR="/caminho/do/backup/local" # Diretório onde o backup local será salvo</span>  
<span style="background-color: rgb(206, 212, 217);">RCLONE\_REMOTE="nome\_do\_remote:backup" # Configuração do rclone (ex: gdrive:backup)</span>

**<span style="background-color: rgb(206, 212, 217);">\# Data e hora atuais para adicionar aos nomes dos arquivos</span>**  
<span style="background-color: rgb(206, 212, 217);">now=$(date +"%Y-%m-%d\_%H-%M-%S")</span>

**<span style="background-color: rgb(206, 212, 217);">\# Nome do arquivo de backup</span>**  
<span style="background-color: rgb(206, 212, 217);">BACKUP\_FILE="backup\_$now.tar.gz"</span>

**<span style="background-color: rgb(206, 212, 217);">\# Função para verificar se um comando está disponível</span>**  
<span style="background-color: rgb(206, 212, 217);">check\_command() {</span>  
<span style="background-color: rgb(206, 212, 217);"> command -v "$1" &gt;/dev/null 2&gt;&amp;1 || { echo &gt;&amp;2 "O comando $1 não está instalado. Saindo."; exit 1; }</span>  
<span style="background-color: rgb(206, 212, 217);">}</span>

**<span style="background-color: rgb(206, 212, 217);">\# Verifica se rsync e rclone estão instalados</span>**  
<span style="background-color: rgb(206, 212, 217);">check\_command rsync</span>  
<span style="background-color: rgb(206, 212, 217);">check\_command rclone</span>

**<span style="background-color: rgb(206, 212, 217);">\# Cria o diretório de backup local, se não existir</span>**  
<span style="background-color: rgb(206, 212, 217);">mkdir -p "$LOCAL\_BACKUP\_DIR"</span>

**<span style="background-color: rgb(206, 212, 217);">\# Cria o backup local com rsync</span>**  
<span style="background-color: rgb(206, 212, 217);">echo "Iniciando backup local com rsync..."</span>  
<span style="background-color: rgb(206, 212, 217);">rsync -avzhP --delete "$SOURCE\_DIR/" "$LOCAL\_BACKUP\_DIR/"</span>  
<span style="background-color: rgb(206, 212, 217);">echo "Backup local concluído."</span>

**<span style="background-color: rgb(206, 212, 217);">\# Compacta o backup local</span>**  
<span style="background-color: rgb(206, 212, 217);">echo "Compactando o backup..."</span>  
<span style="background-color: rgb(206, 212, 217);">tar -czf "$LOCAL\_BACKUP\_DIR/$BACKUP\_FILE" -C "$LOCAL\_BACKUP\_DIR" "$(basename "$SOURCE\_DIR")"</span>  
<span style="background-color: rgb(206, 212, 217);">echo "Compactação concluída."</span>

**<span style="background-color: rgb(206, 212, 217);">\# Envia o backup para o serviço de armazenamento em nuvem usando rclone</span>**  
<span style="background-color: rgb(206, 212, 217);">echo "Enviando o backup para o armazenamento em nuvem com rclone..."</span>  
<span style="background-color: rgb(206, 212, 217);">rclone copy "$LOCAL\_BACKUP\_DIR/$BACKUP\_FILE" "$RCLONE\_REMOTE/"</span>  
<span style="background-color: rgb(206, 212, 217);">echo "Backup na nuvem concluído."</span>

**<span style="background-color: rgb(206, 212, 217);">\# Limpa arquivos de backup antigos, mantendo os últimos 5 backups</span>**  
<span style="background-color: rgb(206, 212, 217);">echo "Removendo backups antigos..."</span>  
<span style="background-color: rgb(206, 212, 217);">find "$LOCAL\_BACKUP\_DIR" -type f -name "backup\_\*.tar.gz" -mtime +30 -exec rm {} \\;</span>  
<span style="background-color: rgb(206, 212, 217);">echo "Limpeza concluída."</span>

**<span style="background-color: rgb(206, 212, 217);">\# Mensagem final</span>**  
<span style="background-color: rgb(206, 212, 217);">echo "Processo de backup completo. Arquivo de backup local em: $LOCAL\_BACKUP\_DIR/$BACKUP\_FILE"</span>  
<span style="background-color: rgb(206, 212, 217);">```</span>

**\### Como usar o script:**

1\. \*\*Crie o arquivo do script:\*\*  
 ```bash  
 nano backup\_script.sh  
 ```

2\. \*\*Cole o conteúdo do script no editor e salve o arquivo (Ctrl + X, depois Y, e Enter).\*\*

3\. \*\*Dê permissão de execução ao script:\*\*  
 ```bash  
 chmod +x backup\_script.sh  
 ```

4\. \*\*Execute o script:\*\*  
 ```bash  
 sudo ./backup\_script.sh  
 ```

**\### Explicação dos Comandos e Funções:**

\- \*\*`rsync -av --delete "$SOURCE\_DIR/" "$LOCAL\_BACKUP\_DIR/"`\*\*: Sincroniza o diretório de origem com o diretório de backup local. O `--delete` garante que os arquivos deletados no diretório de origem também sejam removidos do backup.  
\- \*\*`tar -czf "$LOCAL\_BACKUP\_DIR/$BACKUP\_FILE"`\*\*: Compacta o diretório de backup local em um arquivo `.tar.gz`.  
\- \*\*`rclone copy "$LOCAL\_BACKUP\_DIR/$BACKUP\_FILE" "$RCLONE\_REMOTE/"`\*\*: Envia o arquivo de backup compactado para o serviço de armazenamento em nuvem configurado no `rclone`.  
\- \*\*`find "$LOCAL\_BACKUP\_DIR" -type f -name "backup\_\*.tar.gz" -mtime +30 -exec rm {} \\;`\*\*: Remove backups locais antigos, mantendo apenas os últimos 30 dias de backups.

**\### Configuração do `rclone`:**

1\. \*\*Instale o `rclone`:\*\*  
 ```bash  
 sudo apt-get install rclone  
 ```

2\. \*\*Configure o `rclone`:\*\*  
 ```bash  
 rclone config  
 ```  
 Siga as instruções para configurar o `rclone` para o serviço de armazenamento em nuvem de sua escolha.

3\. \*\*Verifique a configuração do `rclone`:\*\*  
 ```bash  
 rclone ls nome\_do\_remote:  
 ```

Substitua os caminhos e nomes conforme necessário para se adequar ao seu ambiente. Se precisar de mais ajustes ou tiver perguntas, estou à disposição!

# How to Upgrade Ubuntu 22.04 to 24.04 LTS: A Complete Guide

Link: [https://www.cyberciti.biz/faq/how-to-upgrade-from-ubuntu-22-04-lts-to-ubuntu-24-04-lts/](https://www.cyberciti.biz/faq/how-to-upgrade-from-ubuntu-22-04-lts-to-ubuntu-24-04-lts/)

<div class="headline_area" id="bkmrk-author%3A%C2%A0vivek-gite%C2%A0l" style="text-align: justify;"><div class="byline">**<span class="post_author_intro">Author:</span> <span class="post_author">Vivek Gite</span> <span class="post_date_intro">Last updated:</span> <span class="post_date date_modified" title="2024-09-05">September 5, 2024</span> [<span class="num_comments">47</span> comments](https://www.cyberciti.biz/faq/how-to-upgrade-from-ubuntu-22-04-lts-to-ubuntu-24-04-lts/#comments)**</div></div><div class="post_content" id="bkmrk-ubuntu-24.04-lts-%28no" style="text-align: justify;">  
<span class="drop_cap">U</span>buntu 24.04 LTS (Noble Numbat) was launched on April 25th, 2024. This new version will be supported for five years until June 2029. The armhf architecture now provides support for the Year 2038 problem. The upgrades include significant updates to core packages like Linux kernel, systemd, Netplan, toolchain upgrades for better development support, enhanced security measures, and performance optimizations. It also has an updated GNOME desktop environment and other default applications. Let us see how to upgrade Ubuntu 22.04 LTS to Ubuntu 24.04 LTS using the CLI over ssh-based session.  
<span id="bkmrk-"></span>  
Users of Ubuntu 23.10 will be offered an automatic upgrade to 24.04 shortly after its release. However, users of Ubuntu 22.04 LTS will only receive the automatic upgrade offer once **24.04.1 LTS becomes available, which is scheduled for August 29** . However, you can force an immediate upgrade using the <kbd>-d</kbd> option and jump from **22.04 to 23.10** and then finally to **24.04 LTS**. This is until August 29, 2024. After that date, you can directly jump from 22.04 to 24.04 LTS directly.  
<table class="tutorialrequirements"><thead><tr><th colspan="2">Tutorial details</th></tr></thead><tbody><tr><td width="25%"><a name="tutorial_difficulty_level"></a><span title="The relative difficulty of completing this tutorial task">Difficulty level</span></td><td width="75%">[Intermediate](https://www.cyberciti.biz/faq/tag/intermediate/ "See all Intermediate Linux / Unix System Administrator Tutorials")</td></tr><tr><td><a name="tutorial_difficulty_level"></a><span title="Indicates whether the root account requires for administrative purposes to complete this tutorial">Root privileges</span></td><td>[Yes](https://www.cyberciti.biz/faq/how-can-i-log-in-as-root/ "See how to login as root user")</td></tr><tr><td><a name="tutorial_difficulty_requirements"></a><span title="Minimum requirements to complete this tutorial">Requirements</span></td><td>Linux terminal</td></tr><tr><td><span title="Primary tutorial category">Category</span></td><td>Server Upgrade</td></tr><tr><td><a name="tutorial_os_compatibility"></a><span title="This tutorial is also compatible with the operating systems (OS) mentioned in the following column">OS compatibility</span></td><td>[Linux](https://www.cyberciti.biz/faq/category/linux/ "See all Linux distributions tutorials") • [Ubuntu](https://www.cyberciti.biz/faq/category/ubuntu-linux/ "See all Ubuntu Linux tutorials")</td></tr></tbody><tbody><tr><td><a name="tutorial_est_reading_time"></a><span title="Estimated reading time for this tutorial page">Est. reading time</span></td><td>7 minutes</td></tr></tbody></table>

<div><small>Advertisement</small>  
<ins class="adsbygoogle" data-ad-client="ca-pub-7825705102693166" data-ad-format="auto" data-ad-slot="7261197400" data-full-width-responsive="true"></ins></div></div>## Step 1 – Backup your system

Backing up your data before upgrading from Ubuntu 22.04 LTS to 24.04 LTS is vital for two reasons. First, even though thoroughly tested, unexpected issues can arise during the upgrade process. If something goes wrong, a backup ensures you can recover irreplaceable files like databases, code written in PHP/Perl/Python, documents, photos, or scripts. Second, upgrading to a new LTS version might introduce changes that cause some of your data incompatibility. A backup allows you to restore and migrate the data to a format compatible with the new Ubuntu version. Remember to back up your data before upgrading to Ubuntu. Don’t blame us if you lose everything!

### How do I backup important data or everything?

Cloud providers usually offer backup options, such as taking a snapshot of your cloud server (here is guide for [EC2](https://docs.aws.amazon.com/prescriptive-guidance/latest/backup-recovery/ec2-backup.html) and [Lightsail VM](https://docs.aws.amazon.com/lightsail/latest/userguide/understanding-instance-snapshots-in-amazon-lightsail.html)). Alternatively, you can use various backup tools like [rsnapshot](https://www.cyberciti.biz/faq/linux-rsnapshot-backup-howto/), [tarsnap](https://www.cyberciti.biz/faq/how-to-compile-and-install-tarsanp-on-a-ubuntudebian-linux/), [restic](https://restic.net/), [kbackup](https://apps.kde.org/kbackup/), [duplicity](https://duplicity.us/), [bacula](https://www.bacula.org/), and [Déjà Dup](https://apps.gnome.org/DejaDup/). Testing your backups and verifying that they can be restored is necessary, as is finding out how long it takes to restore the data.

## Step 2 – Update your system

Run the [apt command](https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ "apt Command Examples for Ubuntu/Debian Linux") to upgrade all installed packages on the Ubuntu 22.04 LTS:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt update<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt list --upgradable | more<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt upgrade`

<div class="post_content" id="bkmrk--1" style="text-align: justify;"><div class="wp-caption aligncenter">[![Upgrading Ubuntu 22.04 LTS apps and packages to the latest version](https://www.cyberciti.biz/media/new/faq/2024/04/Upgrading-Ubuntu-22.04-LTS-apps-and-packages-to-the-latest-version-599x590.png)](https://www.cyberciti.biz/media/new/faq/2024/04/Upgrading-Ubuntu-22.04-LTS-apps-and-packages-to-the-latest-version.png)</div></div>Fig.01: Upgrading Ubuntu 22.04 LTS apps and packages to the latest version (click to enlarge)

<div class="post_content" id="bkmrk-you-may-see-a-messag" style="text-align: justify;"><div class="wp-caption aligncenter" id="bkmrk--2"></div>You may see a message like this while patching 22.04 LTS system:</div>```
<strong>Newer kernel available</strong>
The currently running kernel version is 5.15.0-1030-aws which is not the expected kernel version 6.5.0-1018-aws.  
Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. 
```

Hence, [reboot the Ubuntu Linux box](https://www.cyberciti.biz/faq/howto-reboot-linux/ "Reboot Linux System Command") using the [reboot](https://www.cyberciti.biz/faq/howto-reboot-linux/ "Reboot Linux System Command") or [shutdown](https://www.cyberciti.biz/faq/howto-shutdown-linux/ "How To Shutdown Linux Using Command Line"):  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo reboot`

<div class="post_content" id="bkmrk--3" style="text-align: justify;"><div class="wp-caption aligncenter">[![Rebooting the Ubuntu 22.04 LTS machine](https://www.cyberciti.biz/media/new/faq/2024/04/Rebooting-the-Ubuntu-22.04-LTS-machine-487x599.png)](https://www.cyberciti.biz/media/new/faq/2024/04/Rebooting-the-Ubuntu-22.04-LTS-machine.png)</div></div>Fig.02: Rebooting the Ubuntu 22.04 LTS machine (click to enlarge)

<div class="post_content" id="bkmrk--4" style="text-align: justify;"><div class="wp-caption aligncenter" id="bkmrk--5"></div></div>## Step 3 – Upgrading from 22.04 LTS or 24.04 LTS

You must install ubuntu-release-upgrader-core package:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt install ubuntu-release-upgrader-core`  
Ensure the **<kbd>Prompt</kbd>** line in /etc/update-manager/release-upgrades is set to ‘**<kbd>lts</kbd>**‘ using the “[grep](https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/ "How to use grep command In Linux / UNIX with examples")” or “[cat](https://www.cyberciti.biz/faq/linux-unix-appleosx-bsd-cat-command-examples/ "cat Command in Linux / Unix with examples")”  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>grep 'lts' /etc/update-manager/release-upgrades<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>cat /etc/update-manager/release-upgrades`

<div class="post_content" id="bkmrk--6" style="text-align: justify;"><div class="wp-caption aligncenter">[![Check to see if LTS prompt set or not on Ubuntu 22.04 LTS](https://www.cyberciti.biz/media/new/faq/2024/04/Check-to-see-if-LTS-prompt-set-or-not-on-Ubuntu-22.04-LTS-599x328.png)](https://www.cyberciti.biz/media/new/faq/2024/04/Check-to-see-if-LTS-prompt-set-or-not-on-Ubuntu-22.04-LTS.png)</div></div>Fig.03: Checking if the LTS prompt config is set or not on Ubuntu 22.04 LTS (click to enlarge)

<div class="post_content" id="bkmrk--7" style="text-align: justify;"><div class="wp-caption aligncenter" id="bkmrk--8"></div></div>### Opening up TCP port 1022 using the [ufw command](https://www.cyberciti.biz/faq/how-to-set-up-ufw-firewall-on-ubuntu-24-04-lts-in-5-minutes/ "How to Set Up UFW Firewall on Ubuntu 24.04 LTS in 5 Minutes") or [iptables command](https://www.cyberciti.biz/tips/linux-iptables-examples.html "Linux 25 Iptables Netfilter Firewall Examples")

For those using ssh-based sessions, open an additional SSH port using the ufw command, starting at port 1022. This is the default port set by the upgrade procedure as a fallback if the default SSH port dies during upgrades. The syntax for the [ufw command](https://www.cyberciti.biz/faq/how-to-set-up-ufw-firewall-on-ubuntu-24-04-lts-in-5-minutes/ "How to Set Up UFW Firewall on Ubuntu 24.04 LTS in 5 Minutes") to [open SSH alternative TCP/1022 port with ufw](https://www.cyberciti.biz/faq/ufw-allow-incoming-ssh-connections-from-a-specific-ip-address-subnet-on-ubuntu-debian/ "How to open ssh 22/TCP port using ufw on Ubuntu/Debian Linux") is as follows:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo ufw allow 1022/tcp comment 'Open port ssh TCP/1022 as failsafe for upgrades'<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo ufw status`  
Here is an example for iptables:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo /sbin/iptables -I INPUT -p tcp --dport 1022 -j ACCEPT`  
Open the TCP/1022 port using your cloud server firewall if you have one. Here is how to do it with the AWS [EC2 security groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-security-groups.html) or [Lightsail](https://docs.aws.amazon.com/lightsail/latest/userguide/understanding-firewall-and-port-mappings-in-amazon-lightsail.html) instance:

<div class="post_content" id="bkmrk--9" style="text-align: justify;"><div class="wp-caption aligncenter">[![Open the TCP port 1022 using the CLOUD server firewall](https://www.cyberciti.biz/media/new/faq/2024/04/Open-the-TCP-port-1022-using-the-CLOUD-server-firewall-599x361.png)](https://www.cyberciti.biz/media/new/faq/2024/04/Open-the-TCP-port-1022-using-the-CLOUD-server-firewall.png)</div></div>Fig. 04: Open the TCP port 1022 using the CLOUD server firewall (click to enlarge)

<div class="post_content" id="bkmrk--10" style="text-align: justify;"><div class="wp-caption aligncenter" id="bkmrk--11"></div></div>## Step 4 – Upgrading from Ubuntu 22.04 LTS to Ubuntu 24.04 LTS version

Finally, start the upgrade from Ubuntu 22.04 to 24.04 LTS version. Type:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo do-release-upgrade -d`  
Or you can try upgrading to the latest release using the upgrader from Ubuntu-proposed with version number. For example:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo do-release-upgrade -p '24.04.1 LTS'`

### <span class="highlight">Are you still getting the following error **after August 29, 2024**?</span>

```
There is no development version of an LTS available.  
To upgrade to the latest non-LTS development release set Prompt=normal in 
/etc/update-manager/release-upgrades. 
```

There are multiple ways to upgrade Ubuntu 22.04 LTS before the release of 24.04.1 LTS, scheduled for August 29th, 2024. Here’s one safe method:

<div class="post_content" id="bkmrk-edit-the%C2%A0%2Fetc%2Fupdate" style="text-align: justify;"><div class="bleed yellow"><div class="container"><div class="text post_content"><div class="box pop">1. Edit the <tt>/etc/update-manager/release-upgrades</tt> file and set <tt>Prompt=normal</tt>. Run:  
    `<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo nano /etc/update-manager/release-upgrades`  
    Set: ```
    Prompt=normal
    ```
    
    Save and close the file.
2. Next, run:  
    `<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo do-release-upgrade`  
    Follow all onscreen instructions. This will get you **23.10 release** and reboot the system. Run:  
    `<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo reboot`
3. Then, again edit the <tt>/etc/update-manager/release-upgrades</tt> and set <tt>Prompt=lts</tt>. Type:  
    `<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo nano /etc/update-manager/release-upgrades`  
    Set: ```
    Prompt=lts
    ```
    
    Save and close the file.
4. Finally, type the following command and follow the rest of the guide to upgrade from 23.10 to 24.04 LTS:  
    `<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo do-release-upgrade -d`

</div></div></div></div></div>This note will automatically disappear after August 29th, 2024, as there will be no need for this kind of workaround. As a seasoned sysadmin and developer, I recommend waiting until the release of 24.04.1 LTS (scheduled for August 29th, 2024) before upgrading from Ubuntu 22.04 LTS. This ensures superb stability and minimizes potential compatibility issues with your apps. However, you can use these instructions for testing purposes. This is a great way to check if your applications will work seamlessly with Ubuntu 24.04 LTS.

<div class="post_content" id="bkmrk-you-will-get-welcome" style="text-align: justify;"><div class="bleed yellow"><div class="container"><div class="text post_content"><div class="box pop">  
</div></div></div></div>You will get welcome message as follows:</div>```
Checking for a new Ubuntu release
 
= Welcome to Ubuntu 24.04 LTS 'Noble Numbat' =
 
The Ubuntu team is proud to announce Ubuntu 24.04 LTS 'Noble Numbat'.
 
To see what's new in this release, visit:
  https://wiki.ubuntu.com/NobleNumbat/ReleaseNotes
 
Ubuntu is a Linux distribution for your desktop or server, with a fast
and easy install, regular releases, a tight selection of excellent
applications installed by default, and almost any other software you
can imagine available through the network.
 
We hope you enjoy Ubuntu.
....
...
To sign up for future Ubuntu announcements, please subscribe to Ubuntu's
very low volume announcement list at:
 
  http://lists.ubuntu.com/mailman/listinfo/ubuntu-announce
 
 
Continue [yN]
```

Then it will tell you about ssh port what you already opened:

```
Reading cache
 
Checking package manager
 
Continue running under SSH? 
 
This session appears to be running under ssh. It is not recommended 
to perform a upgrade over ssh currently because in case of failure it 
is harder to recover. 
 
If you continue, an additional ssh daemon will be started at port 
'1022'. 
Do you want to continue? 
 
Continue [yN]
```

Finally, you need to confirm to start upgrade procedure:

<div class="post_content" id="bkmrk--12" style="text-align: justify;"><div class="wp-caption aligncenter">[![How to Upgrade from Ubuntu 22.04 LTS to Ubuntu 24.04 LTS using the CLI](https://www.cyberciti.biz/media/new/faq/2024/04/How-to-Upgrade-from-Ubuntu-22.04-LTS-to-Ubuntu-24.04-LTS-using-the-CLI-599x379.png)](https://www.cyberciti.biz/media/new/faq/2024/04/How-to-Upgrade-from-Ubuntu-22.04-LTS-to-Ubuntu-24.04-LTS-using-the-CLI.png)</div></div>Fig.05 : Upgrading Ubuntu from 23.04 or 22.04 to 24.04 (click to enlarge)

<div class="post_content" id="bkmrk--13" style="text-align: justify;"><div class="wp-caption aligncenter" id="bkmrk--14"></div></div>### Dealing with “Remove obsolete packages?” message

You will get message as follows:

```
Remove obsolete packages? 
 
27 packages are going to be removed. 
 
 Continue [yN]  Details [d]
```

You need to review those carefully and only remove those packages if you do not need them. Otherwise, choose ‘N’ option.

### System upgrade is complete

The movement has arrived. The system upgrade is complete. All you need to say ‘Y’ to reboot the system and pray that it comes online:

<div class="post_content" id="bkmrk--15" style="text-align: justify;"><div class="wp-caption aligncenter">[![Rebooting into Ubuntu 24.04 LTS server](https://www.cyberciti.biz/media/new/faq/2024/04/Rebooting-into-Ubuntu-24.04-LTS-server-599x328.png)](https://www.cyberciti.biz/media/new/faq/2024/04/Rebooting-into-Ubuntu-24.04-LTS-server.png)</div></div>Fig.06: Rebooting into Ubuntu 24.04 LTS server (click to enlarge)

<div class="post_content" id="bkmrk--16" style="text-align: justify;"><div class="wp-caption aligncenter" id="bkmrk--17"></div></div>## Step 5 – Verification

Use the command lsb\_release command or [cat command](https://www.cyberciti.biz/faq/linux-unix-appleosx-bsd-cat-command-examples/ "cat Command in Linux / Unix with examples") to check your Ubuntu Linux version. This command queries the <tt><span title="Linux or Unix /etc/os-release file format">/etc/os-release</span></tt> and provides you with the version information:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>cat /etc/os-release`  
Here is what I see:

```
PRETTY_NAME="Ubuntu 24.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.1 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
```

And:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>lsb_release -a`  
Outputs:

```
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble
```

Check the Linux kernel version as follows using the uname command:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>uname -mrsOutputs:<tt><small>Linux 6.8.0-1014-aws x86_64</small></tt>`  
[![Ubuntu 24.04 LTS SERVER](https://www.cyberciti.biz/media/new/faq/2024/04/Ubuntu-24.04-LTS-SERVER-599x421.png)](https://www.cyberciti.biz/media/new/faq/2024/04/Ubuntu-24.04-LTS-SERVER.png)  
Please note that the Linux kernel version may very from time to time as new patches are applied to Ubuntu 24.04.xx LTS release.

## Step 6 – Enabling 3rd party repos/mirros

After completing the upgrade to Ubuntu 22.04 LTS (or 23.10) to 24.04 LTS, ensure that you enable 3rd party mirrors and repositories; otherwise, you will not receive updates. Use the following [cd command](https://bash.cyberciti.biz/guide/Cd_command "Cd command - Linux Bash Shell Scripting Tutorial Wiki"):  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>cd /etc/apt/sources.list.d<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>ls -l`  
For example, my app repo was disabled during updates:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>cat my-cool-apps.list`  
Outputs:

```
#deb [arch=amd64] https://dl.www.cyberciti.biz/linux/deb/ stable main
```

To enable it again, I commented out the line by removing the #:

```
deb [arch=amd64] https://dl.www.cyberciti.biz/linux/deb/ stable main
```

Then run the apt command:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt update<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt upgrade`  
Finally, clean up unwanted and unused leftover packages:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo apt autoremove --purge`  
Make sure to remove the iptables/ufw firewall rule that was added earlier to open the alternate SSH port at TCP/1022. For example:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo ufw show added# add the delete rule before the allow keyword<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>sudo ufw delete allow 1022/tcp comment 'Open port ssh tcp port 1022 as failsafe option for upgrades'`  
See “[How to delete a UFW firewall rule on Ubuntu / Debian Linux](https://www.cyberciti.biz/faq/how-to-delete-a-ufw-firewall-rule-on-ubuntu-debian-linux/ "How to delete a UFW firewall rule on Ubuntu / Debian Linux")” for more info.

## Wrapping up

Congratulations! You’ve successfully upgraded your Ubuntu system from 22.04 LTS or 23.10 to the latest 24.04 LTS using the command line. For in-depth details, explore the official Ubuntu 24.04 [release notes](https://discourse.ubuntu.com/t/noble-numbat-release-notes/39890) and read manual pages using “[man](https://bash.cyberciti.biz/guide/Man_command "Man command - Linux Bash Shell Scripting Tutorial Wiki")” or “[help](https://bash.cyberciti.biz/guide/Man_command "Man command - Linux Bash Shell Scripting Tutorial Wiki")“:  
`<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>man do-release-upgrade<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>man apt<span class="normaluserprompt" title="The shell prompt usually ends in a $ sign and is not part of the command for the nonprivileged user.">$ </span>man apt-get`

# Como adicionar espaço de swap no Ubuntu 20.04

Link: [https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt)

### [Introdução](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#introducao)

Um das maneiras de se proteger contra erros de memória insuficiente em aplicativos é através da adição de um espaço de swap ao seu servidor. Neste guia, falaremos sobre como adicionar um arquivo swap a um servidor Ubuntu 20.04.

**Aviso:** embora o swap seja geralmente recomendado para sistemas que utilizam discos rígidos tradicionais, o uso do swap em SSDs pode causar problemas de degradação de hardware ao longo do tempo. Por este motivo, não recomendamos a habilitação do swap na DigitalOcean ou em qualquer outro provedor que utilize armazenamento SSD.

## [O que é o Swap?](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#o-que-e-o-swap)

O *Swap* é uma parcela do armazenamento do disco rígido que foi reservada para o sistema operacional com o objetivo de armazenar temporariamente dados que ele não consegue mais reter na RAM. Isso permite que você aumente a quantidade de informações que seu servidor consegue manter em sua memória de trabalho, com algumas advertências. O espaço de swap no disco rígido será usado principalmente quando já não houver espaço suficiente em RAM para manter os dados do aplicativo em uso.

As informações gravadas no disco ficarão significativamente mais lentas do que as informações mantidas em RAM, mas o sistema operacional preferirá manter os dados do aplicativo em memória e usar o swap para os dados mais antigos. De maneira geral, ter espaço de swap como uma alternativa para quando a RAM do seu sistema estiver esgotada pode ser uma boa estratégia de segurança contra exceções de memória insuficiente nos sistemas com armazenamento disponível que não seja SSD.

## [Passo 1 – Verificando o Sistema em Relação às Informações de Swap (troca)](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#passo-1-verificando-o-sistema-em-relacao-as-informacoes-de-swap-troca)

Antes de começarmos, podemos verificar se o sistema já tem algum espaço de swap (troca) disponível. É possível ter vários arquivos de swap ou partições de swap, mas geralmente um deve ser o suficiente.

Podemos descobrir se o sistema tem algum swap configurado digitando:

<div class="code-label" id="bkmrk-" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-swapon---show" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">swapon</span> <span class="token parameter variable">--show</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Se você não receber nenhum resultado, isso significa que seu sistema não tem espaço de swap disponível atualmente.

Você pode verificar se não existe um swap ativo usando o utilitário `free`:

<div class="code-label" id="bkmrk--3" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-free--h" style="text-align: justify;">1. <span class="token function">free</span> <span class="token parameter variable">-h</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-1" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--6" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output" style="text-align: justify;" title="Output">Output</div>```
              total        used        free      shared  buff/cache   available
Mem:          981Mi       122Mi       647Mi       0.0Ki       211Mi       714Mi
<mark>Swap:            0B          0B          0B</mark>

```

Como você pode ver na linha **Swap** do resultado, nenhum swap está ativo no sistema.

## [Passo 2 – Verificando o Espaço Disponível na Partição do Disco Rígido](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#passo-2-verificando-o-espaco-disponivel-na-particao-do-disco-rigido)

Antes de criarmos nosso arquivo de swap, verificaremos o uso atual do disco para garantir que temos espaço suficiente. Faça isso digitando:

<div class="code-label" id="bkmrk--8" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-df--h" style="text-align: justify;">1. <span class="token function">df</span> <span class="token parameter variable">-h</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-2" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--11" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-1" style="text-align: justify;" title="Output">Output</div>```
Filesystem      Size  Used Avail Use% Mounted on
udev            474M     0  474M   0% /dev
tmpfs            99M  932K   98M   1% /run
<mark>/dev/vda1        25G  1.4G   23G   7% /</mark>
tmpfs           491M     0  491M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           491M     0  491M   0% /sys/fs/cgroup
/dev/vda15      105M  3.9M  101M   4% /boot/efi
/dev/loop0       55M   55M     0 100% /snap/core18/1705
/dev/loop1       69M   69M     0 100% /snap/lxd/14804
/dev/loop2       28M   28M     0 100% /snap/snapd/7264
tmpfs            99M     0   99M   0% /run/user/1000

```

O dispositivo com `/` na coluna `Mounted on` é o nosso disco neste caso. Temos bastante espaço disponível neste exemplo (apenas 1,4 GB usado). Seu uso provavelmente será diferente.

Apesar da divergência de opiniões quanto ao tamanho adequado de um espaço de swap, isso realmente dependerá de suas preferências pessoais e das exigências da sua aplicação. Geralmente, um espaço igual ou duas vezes o tamanho do espaço da RAM no seu sistema é um bom ponto de partida. Outra boa regra de ouro é que qualquer coisa acima de 4 GB de swap é provavelmente desnecessária se você somente estiver usando-o como uma alternativa para a RAM.

## [Passo 3 – Criando um Arquivo de Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#passo-3-criando-um-arquivo-de-swap)

Agora que sabemos qual é o espaço disponível em nosso disco rígido, podemos criar um arquivo de swap no nosso sistema de arquivos. Alocaremos um arquivo do tamanho que queremos que o swap tenha chamado de `swapfile` em nosso diretório raiz (`/`).

A melhor maneira de criar um arquivo de swap é com o programa `fallocate`. Este comando cria instantaneamente um arquivo do tamanho especificado.

Uma vez que o servidor no nosso exemplo tem 1 GB de RAM, criaremos um arquivo de 1 GB neste guia. Ajuste isso para atender às necessidades do seu próprio servidor:

<div class="code-label" id="bkmrk--13" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-fallocate--l-1g" style="text-align: justify;">1. <span class="token function">sudo</span> fallocate <span class="token parameter variable">-l</span> <mark>1G</mark> /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-3" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Podemos verificar se a quantidade correta de espaço foi reservada digitando:

<div class="code-label" id="bkmrk--16" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-ls--lh-%2Fswapfile" style="text-align: justify;">1. <span class="token function">ls</span> <span class="token parameter variable">-lh</span> /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-4" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--19" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk--rw-r--r---1-root-ro" style="text-align: justify;">1. -rw-r--r-- <span class="token number">1</span> root root <span class="token number">1</span>.0G Apr <span class="token number">25</span> <span class="token number">11</span>:14 /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-5" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Nosso arquivo foi criado com a quantidade correta do espaço reservado.

## [Passo 4 – Habilitando o Arquivo de Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#passo-4-habilitando-o-arquivo-de-swap)

Agora que temos um arquivo do tamanho correto disponível, precisamos realmente transformar isso em espaço de swap.

Primeiro, precisamos bloquear as permissões do arquivo para que apenas os usuários com privilégios **root** possam ler o conteúdo. Isso impede que os usuários normais possam acessar o arquivo, o que teria implicações de segurança significativas.

Torne o arquivo acessível somente para **root** digitando:

<div class="code-label" id="bkmrk--22" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-chmod-600-%2Fswap" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">chmod</span> <span class="token number">600</span> /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-6" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Verifique a alteração de permissões digitando:

<div class="code-label" id="bkmrk--25" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-ls--lh-%2Fswapfile-1" style="text-align: justify;">1. <span class="token function">ls</span> <span class="token parameter variable">-lh</span> /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-7" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--28" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-2" style="text-align: justify;" title="Output">Output</div>```
<mark>-rw-------</mark> 1 root root 1.0G Apr 25 11:14 /swapfile

```

Como você pode ver, apenas o usuário **root** tem os sinalizadores de leitura e gravação habilitados.

Podemos agora marcar o arquivo como espaço de swap digitando:

<div class="code-label" id="bkmrk--30" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-mkswap-%2Fswapfil" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">mkswap</span> /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-8" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--33" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-3" style="text-align: justify;" title="Output">Output</div>```
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=6e965805-2ab9-450f-aed6-577e74089dbf

```

Após marcar o arquivo, podemos habilitar o arquivo de swap, permitindo que nosso sistema comece a utilizá-lo:

<div class="code-label" id="bkmrk--35" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-swapon-%2Fswapfil" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">swapon</span> /swapfile

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-9" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Verifique se o swap está disponível digitando:

<div class="code-label" id="bkmrk--38" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-swapon---show-1" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">swapon</span> <span class="token parameter variable">--show</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-10" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--41" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-4" style="text-align: justify;" title="Output">Output</div>```
NAME      TYPE  SIZE USED PRIO
/swapfile file 1024M   0B   -2

```

Podemos verificar a saída do utilitário `free` novamente para corroborar nossos resultados:

<div class="code-label" id="bkmrk--43" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-free--h-1" style="text-align: justify;">1. <span class="token function">free</span> <span class="token parameter variable">-h</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-11" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--46" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-5" style="text-align: justify;" title="Output">Output</div>```
              total        used        free      shared  buff/cache   available
Mem:          981Mi       123Mi       644Mi       0.0Ki       213Mi       714Mi
<mark>Swap:         1.0Gi          0B       1.0Gi</mark>

```

Nosso swap foi configurado com sucesso e nosso sistema operacional começará a usá-lo conforme necessário.

## [Passo 5 – Tornando o Arquivo de Swap Permanente](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#passo-5-tornando-o-arquivo-de-swap-permanente)

Nossas alterações recentes habilitaram o arquivo de swap para a sessão atual. No entanto, se reiniciarmos, o servidor não manterá as configurações de swap automaticamente. Podemos alterar isso adicionando o arquivo de swap ao nosso arquivo `/etc/fstab`.

Faça um backup do arquivo `/etc/fstab` para o caso de algo dar errado:

<div class="code-label" id="bkmrk--48" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-cp-%2Fetc%2Ffstab-%2F" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">cp</span> /etc/fstab /etc/fstab.bak

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-12" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Adicione a informação do arquivo de swap no final do seu arquivo `/etc/fstab` digitando:

<div class="code-label" id="bkmrk--51" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-echo-%27%2Fswapfile-none" style="text-align: justify;">1. <span class="token builtin class-name">echo</span> <span class="token string">'/swapfile none swap sw 0 0'</span> <span class="token operator">|</span> <span class="token function">sudo</span> <span class="token function">tee</span> <span class="token parameter variable">-a</span> /etc/fstab

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-13" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>Em seguida, avaliaremos algumas configurações que podemos atualizar para ajustar nosso espaço de swap.

## [Passo 6 – Ajustando as Configurações de Swap](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#passo-6-ajustando-as-configuracoes-de-swap)

Há algumas opções que você pode configurar que terão um impacto no desempenho do seu sistema quando estiver lidando com o swap.

### [Ajustando a propriedade Swappiness](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#ajustando-a-propriedade-swappiness)

O parâmetro `swappiness` configura a frequência com que o seu sistema transfere dados da RAM para o espaço de swap. Esse é um valor entre 0 e 100 que representa uma porcentagem.

Com valores próximos de zero, o kernel não irá transferir dados para o disco a menos que seja absolutamente necessário. Lembre-se, as interações com o arquivo de swap são “dispendiosas”, no sentido de que demoram mais que as interações com a RAM e podem causar uma redução significativa no desempenho. Dizer ao sistema para não depender tanto do swap irá geralmente tornar o seu sistema mais rápido.

Valores que estão mais próximos de 100 irão tentar colocar mais dados no swap em um esforço para manter mais espaço da RAM livre. Dependendo do perfil de memória de seus aplicativos ou do motivo pelo qual você está usando o seu servidor, isso pode ser melhor em alguns casos.

Podemos ver o valor atual do parâmetro swappiness digitando:

<div class="code-label" id="bkmrk--54" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-cat-%2Fproc%2Fsys%2Fvm%2Fswa" style="text-align: justify;">1. <span class="token function">cat</span> /proc/sys/vm/swappiness

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-14" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--57" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-6" style="text-align: justify;" title="Output">Output</div>```
60

```

Para um desktop, um valor de swappiness de 60 não é um valor ruim. Para um servidor, você pode deixá-lo mais próximo de 0.

Podemos definir o parâmetro swappiness para um valor diferente usando o comando `sysctl`.

Por exemplo, para definir o valor do parâmetro swappiness em 10, poderíamos digitar:

<div class="code-label" id="bkmrk--59" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-sysctl-vm.swapp" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">sysctl</span> <span class="token assign-left variable">vm.swappiness</span><span class="token operator">=</span><span class="token number">10</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-15" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--62" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-7" style="text-align: justify;" title="Output">Output</div>```
vm.swappiness = 10

```

Este valor persistirá até a próxima reinicialização. Podemos definir este valor automaticamente na reinicialização, adicionando a linha no nosso arquivo `/etc/sysctl.conf`:

<div class="code-label" id="bkmrk--64" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-nano-%2Fetc%2Fsysct" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">nano</span> /etc/sysctl.conf

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-16" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>No final, você pode adicionar:

<div class="code-label" id="bkmrk-%2Fetc%2Fsysctl.conf" style="text-align: justify;" title="/etc/sysctl.conf">/etc/sysctl.conf</div>```
vm.swappiness=10

```

Salve e feche o arquivo quando você terminar.

### [Ajustando a Configuração da Pressão por Cache](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#ajustando-a-configuracao-da-pressao-por-cache)

Outro valor relacionado que você pode querer modificar é o `vfs_cache_pressure`. Este ajuste configura o quanto o sistema escolherá para as informações cache dos objetos *inode* e *dentry* em detrimento de outros dados.

Basicamente, tratam-se de dados de acesso sobre o sistema de arquivos. De maneira geral, isso é difícil de consultar e, com frequência, muito solicitado. Assim, é algo muito bom que o seu sistema armazene dados em cache. Você pode ver o valor atual questionando o sistema de arquivos `proc` novamente:

<div class="code-label" id="bkmrk--67" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-cat-%2Fproc%2Fsys%2Fvm%2Fvfs" style="text-align: justify;">1. <span class="token function">cat</span> /proc/sys/vm/vfs\_cache\_pressure

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-17" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--70" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-8" style="text-align: justify;" title="Output">Output</div>```
100

```

Uma vez que ele está atualmente configurado, o nosso sistema remove as informações de inode do cache muito rapidamente. Podemos definir isso em um valor mais conservador como 50, digitando:

<div class="code-label" id="bkmrk--72" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-sysctl-vm.vfs_c" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">sysctl</span> <span class="token assign-left variable">vm.vfs\_cache\_pressure</span><span class="token operator">=</span><span class="token number">50</span>

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-18" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div><div class="code-label" id="bkmrk--75" style="text-align: justify;" title="">  
</div>```
```

<div class="secondary-code-label" id="bkmrk-output-9" style="text-align: justify;" title="Output">Output</div>```
vm.vfs_cache_pressure = 50

```

Novamente, isso é apenas válido para a nossa sessão atual. Podemos alterar esse valor, adicionando-o ao nosso arquivo de configuração como fizemos com a nossa configuração do parâmetro swappiness:

<div class="code-label" id="bkmrk--77" style="text-align: justify;" title="">  
</div>```
```

<div class="code-toolbar" id="bkmrk-sudo-nano-%2Fetc%2Fsysct-1" style="text-align: justify;">1. <span class="token function">sudo</span> <span class="token function">nano</span> /etc/sysctl.conf

</div>```
```

<div class="code-toolbar" id="bkmrk-copy-19" style="text-align: justify;"><div class="toolbar"><div class="toolbar-item"><button>Copy</button></div></div></div>No final, adicione a linha que especifica o seu novo valor:

<div class="code-label" id="bkmrk-%2Fetc%2Fsysctl.conf-1" style="text-align: justify;" title="/etc/sysctl.conf">/etc/sysctl.conf</div>```
vm.vfs_cache_pressure=50

```

Salve e feche o arquivo quando você terminar.

## [Conclusão](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04-pt#conclusao)

Seguir as etapas deste guia lhe dará algum espaço para respirar em casos que de outra forma conduziriam a exceções de falta de memória. O espaço de swap pode ser incrivelmente útil para evitar alguns desses problemas comuns.

Se você está encontrando erros de OOM (out of memory - falta de memória), ou se você descobrir que o seu sistema não consegue usar os aplicativos de que você precisa, a melhor solução é otimizar as configurações do seu aplicativo ou atualizar o seu servidor.

# Formatar horário no Linux para 24 horas

Extraído do ChatGPT

### **1. Pelo Ambiente Gráfico (GUI):**

1. **Abra as Configurações de Data e Hora:**
    
    
    - Clique no menu no canto superior direito da tela e selecione **Configurações**.
    - Navegue até **Região e Idioma** ou **Data e Hora** (o nome exato pode variar dependendo da versão do Ubuntu).
2. **Configurar o Formato de Hora:**
    
    
    - No menu de Região e Idioma, escolha o idioma principal.
    - Certifique-se de que o formato de hora está configurado para o padrão de 24 horas. 
        - Em algumas versões, você verá uma opção como **Formato de Hora: 12 horas / 24 horas**. Escolha **24 horas**.
    - Caso contrário, ajuste o formato manualmente seguindo as próximas instruções no terminal.

---

### **2. Pelo Terminal:**

#### **Ajustar o Formato de Hora no GNOME (outra interface gráfica):**

1. **Verifique o Formato Atual:**
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none">bash</div><div class="sticky top-9 md:top-[5.75rem]"><div class="absolute bottom-0 right-2 flex h-9 items-center"><div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center select-none py-1"><svg class="icon-sm" fill="none" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z" fill="currentColor" fill-rule="evenodd"></path></svg>Copiar código</button></span></div></div></div><div class="overflow-y-auto p-4" dir="ltr">`gsettings get org.gnome.desktop.interface clock-format`</div></div>
    - O resultado será `12h` ou `24h`.
2. **Configurar para 24 Horas:**
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none">bash</div><div class="sticky top-9 md:top-[5.75rem]"><div class="absolute bottom-0 right-2 flex h-9 items-center"><div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center select-none py-1"><svg class="icon-sm" fill="none" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z" fill="currentColor" fill-rule="evenodd"></path></svg>Copiar código</button></span></div></div></div><div class="overflow-y-auto p-4" dir="ltr">`gsettings <span class="hljs-built_in">set</span> org.gnome.desktop.interface clock-format <span class="hljs-string">'24h'</span>`</div></div>

---

#### **Configurar o Formato no Sistema:**

1. **Editar o Locale (Formato de Data e Hora do Sistema):**
    
    
    - Abra o arquivo de configuração do locale com seu editor favorito, por exemplo: <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none">bash</div><div class="sticky top-9 md:top-[5.75rem]"><div class="absolute bottom-0 right-2 flex h-9 items-center"><div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center select-none py-1"><svg class="icon-sm" fill="none" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z" fill="currentColor" fill-rule="evenodd"></path></svg>Copiar código</button></span></div></div></div><div class="overflow-y-auto p-4" dir="ltr">`sudo nano /etc/default/locale`</div></div>
    - Adicione ou edite a linha para incluir: <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none">plaintext</div><div class="sticky top-9 md:top-[5.75rem]"><div class="absolute bottom-0 right-2 flex h-9 items-center"><div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center select-none py-1"><svg class="icon-sm" fill="none" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z" fill="currentColor" fill-rule="evenodd"></path></svg>Copiar código</button></span></div></div></div><div class="overflow-y-auto p-4" dir="ltr">`LC_TIME="en_GB.UTF-8"`</div></div>
        - O `en_GB.UTF-8` é o padrão do Reino Unido, que usa o formato de 24 horas. Você pode usar outro locale adequado ao seu idioma, como `pt_BR.UTF-8`.
2. **Atualize as Configurações:**
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none">bash</div><div class="sticky top-9 md:top-[5.75rem]"><div class="absolute bottom-0 right-2 flex h-9 items-center"><div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center select-none py-1"><svg class="icon-sm" fill="none" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z" fill="currentColor" fill-rule="evenodd"></path></svg>Copiar código</button></span></div></div></div><div class="overflow-y-auto p-4" dir="ltr">`sudo locale-gensudo update-locale`</div></div>
3. **Reinicie o sistema ou a interface gráfica** para aplicar as mudanças:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary dark:bg-gray-950"><div class="flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none">bash</div><div class="sticky top-9 md:top-[5.75rem]"><div class="absolute bottom-0 right-2 flex h-9 items-center"><div class="flex items-center rounded bg-token-sidebar-surface-primary px-2 font-sans text-xs text-token-text-secondary dark:bg-token-main-surface-secondary"><span class="" data-state="closed"><button class="flex gap-1 items-center select-none py-1"><svg class="icon-sm" fill="none" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M7 5C7 3.34315 8.34315 2 10 2H19C20.6569 2 22 3.34315 22 5V14C22 15.6569 20.6569 17 19 17H17V19C17 20.6569 15.6569 22 14 22H5C3.34315 22 2 20.6569 2 19V10C2 8.34315 3.34315 7 5 7H7V5ZM9 7H14C15.6569 7 17 8.34315 17 10V15H19C19.5523 15 20 14.5523 20 14V5C20 4.44772 19.5523 4 19 4H10C9.44772 4 9 4.44772 9 5V7ZM5 9C4.44772 9 4 9.44772 4 10V19C4 19.5523 4.44772 20 5 20H14C14.5523 20 15 19.5523 15 19V10C15 9.44772 14.5523 9 14 9H5Z" fill="currentColor" fill-rule="evenodd"></path></svg>Copiar código</button></span></div></div></div><div class="overflow-y-auto p-4" dir="ltr">`sudo systemctl restart gdm3`</div></div>

**Para não precisar reiniciar o sistema pode ser utilizado o comando:**

source /root/.bashrc para carregar as novas configurações.

# Como Alterar o Fuso Horário no Ubuntu (3 Métodos Fáceis)

Link: [https://www.hostinger.com.br/tutoriais/alterar-fuso-horario-ubuntu](https://www.hostinger.com.br/tutoriais/alterar-fuso-horario-ubuntu)

Alterar o fuso horário no Linux é algo essencial para tarefas e processos como registro de dados, *cron jobs* e para a gestão em geral de um [servidor virtual privado](https://www.hostinger.com.br/tutoriais/o-que-e-vps-como-escolher-um-servidor-vps) baseado em Ubuntu ou outras distribuições.

Além disso, a maioria dos aplicativos usa o fuso horário apra gerenciar os seus dados. No caso do Ubuntu, o fuso horário do sistema é definido durante a configuração inicial, mas os usuários ainda podem modificá-lo.

Este artigo vai explicar como alterar o fuso horário no Linux usando três métodos fáceis. Neste texto, vamos focar sobre a distribuição Ubuntu. Recomendamos que você leia nosso outro tutorial se quiser aprender [como alterar o fuso horário no CentOS](https://www.hostinger.com.br/tutoriais/como-alterar-fuso-horario-centos-7).

Conteúdo

<div class="ez-toc-v2_0_67_1 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction" id="bkmrk-como-alterar-o-fuso-" style="text-align: justify;"><div class="ez-toc-title-container">  
</div><nav>- [Como Alterar o Fuso Horário no Ubuntu](https://www.hostinger.com.br/tutoriais/alterar-fuso-horario-ubuntu#Como_Alterar_o_Fuso_Horario_no_Ubuntu "Como Alterar o Fuso Horário no Ubuntu")
    - [Usando a Interface Gráfica do Usuário (GUI)](https://www.hostinger.com.br/tutoriais/alterar-fuso-horario-ubuntu#Usando_a_Interface_Grafica_do_Usuario_GUI "Usando a Interface Gráfica do Usuário (GUI)")
    - [Usando timedatectl (via Linha de Comando)](https://www.hostinger.com.br/tutoriais/alterar-fuso-horario-ubuntu#Usando_timedatectl_via_Linha_de_Comando "Usando timedatectl (via Linha de Comando)")
    - [Usando o Comando tzdata (Versões Mais Antigas do Ubuntu)](https://www.hostinger.com.br/tutoriais/alterar-fuso-horario-ubuntu#Usando_o_Comando_tzdata_Versoes_Mais_Antigas_do_Ubuntu "Usando o Comando tzdata (Versões Mais Antigas do Ubuntu)")

</nav></div>## <span class="ez-toc-section" id="bkmrk--1"></span>**Como Alterar o Fuso Horário no Ubuntu**

Nesta seção, vamos mostrar passo-a-passo como alterar o fuso horário no Ubuntu, para que você possa gerenciar melhor o seu [VPS Linux](https://www.hostinger.com.br/servidor-vps). Certifique-se de se logar como **usuário root** para executar as seguintes ações.

### <span class="ez-toc-section" id="bkmrk--3"></span>**Usando a Interface Gráfica do Usuário (GUI)**

A maneira mais conveniente de alterar o fuso horário num sistema Ubuntu é através da **interface gráfica do usuário** (**GUI**). Como ela é acessível a partir da área de trabalho, você não precisa rodar nenhum comando.

Confira como alterar o fuso horário usando a GUI — as instruções se aplicam para Ubuntu 18.04, Ubuntu 20.04 e Ubuntu 22.04:

1. Clique no menu **System** (Sistema) no canto superior direito da tela.
2. Selecione **Settings** (Configurações) e vá até a aba **Date &amp; Time** (Data e Hora).  
    ![menu de data e hora no ubuntu](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/The-Date-Time-menu-of-Ubuntu.webp)
3. Desmarque a opção **Automatic Time Zone** (Fuso Horário Automático). Se essa configuração estivar **ativada** e o sistema estiver conectado à internet, ele vai automaticamente determinar o fuso horário de acordo com a localização do usuário.  
    ![opção de data e hora automática desligada](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/The-Automatic-Date-Time-option-turned-off.webp)
4. Clique em **Fuso Horário**.  
    ![menu de data e hora do ubuntu com a opção de fuso horário destacada](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/The-Date-Time-menu-of-Ubuntu-with-the-Time-Zone-option-highlighted.webp)
5. Uma nova janela vai aparecer. Selecione o novo fuso horário clicando diretamente no mapa ou usando a barra de pesquisa.  
    ![exibição de data e hora em mapa do ubuntu](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/Ubuntus-Time-Zone-map-display.webp)
6. Assim que tiver terminado, clique no botão **X** para fechar a janela.

Confira a caixa **Time Zone** (Fuso Horário) dentro da aba **Data e Hora** para verificar se o novo fuso horário e adata atual foram atualizados com sucesso.

<div class="wp-block-image" id="bkmrk--4" style="text-align: justify;"><figure class="aligncenter size-full">![fuso horário alterado para paris, frança](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2022/12/Date-Time-and-Time-Zone-changed.webp)</figure></div>### <span class="ez-toc-section" id="bkmrk--5"></span>**Usando timedatectl (via Linha de Comando)**

Existem duas maneiras de configurar o fuso horário de um servidor através da linha de comando — usando **tzselect** ou **timedatectl**. Contudo, o primeiro comando só funciona para mudar o fuso horário de maneira temporária.

Se você optar por usar o **tzselect**, o fuso horário será revertido para o que estiver determinado no arquivo **/etc/timezone** depois que o computador ou servidor for reiniciado. Você ainda pode usar este comando como uma maneira alternativa de listar as opções de fuso horário no sistema.

Para fazer isso, abra o **Terminal** na sua interface de linha de comando (CLI) e rode o comando tzselect. Então, especifique o fuso horário desejado e aperte **Enter**.

<div class="wp-block-image" id="bkmrk--6" style="text-align: justify;"><figure class="aligncenter size-full">![lista de opções de fuso horário no ubuntu](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2022/12/List-timezones-option-on-Ubuntu.webp)</figure></div>Um dos melhores métodos para alterar o fuso horário de maneira permanente no Ubuntu é usando o comando `timedatectl`. Esse é um recurso do Linux que permite que os usuários revisem e alterem a configuração do relógio do sistema.

Além disso, o comando **timedatectl** permite que os usuários modifiquem a data e a hora atuais do sistema, definam um fuso horário e sincronizem automaticamente o relógio através de um servidor remoto. Nós recomendamos que você faça isso se a sua máquina está rodando Ubuntu 18.04, Ubuntu 20.04 ou Ubuntu 22.04.

Veja como mudar o fuso horário usando este método:

1. Abra seu CLI. Rode o comando timedatectl para conferir o fuso horário atual do sistema.
2. A resposta abaixo mostra que o horário local está definido para o Tempo Universal Coordenado (UTC).  
    ![fuso horário do sistema está definido para utc](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/The-systems-local-timezone-is-set-to-UTC-1.webp)
3. Encontre o nome completo do seu fuso horário. Normalmente, a convenção usa o formato **Região/Cidade**. Insira o comando abaixo para ver a lista de fusos horários:  
    <div class="enlighter-default enlighter-v-inline enlighter-t-classic enlighter-l-generic "><span class="enlighter"><span class="enlighter-text">timedatectl list-timezones</span></span></div>  
    ![lista de fusos horários no ubuntu](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/List-of-timezones-on-Ubuntu-1.webp)
4. De maneira alternativa, combine o comando **timedatectl** com o [comando grep](https://www.hostinger.com.br/tutoriais/comando-grep-linux) para filtrar a pesquisa usando o nome de uma cidade.  
    `timedatectl list-timezones | grep Paris`
5. Pressione **Ctrl + C para sair**
6. Assim que tiver decidido qual fuso horário selecionar, rode o seguinte comando para realizar a mudança. Note que ele não vai produzir qualquer resposta:  
    `sudo timedatectl set-timezone [timezone]`
7. Insira o comando abaixo e pressione **Enter** para verificar a atualização:  
    `timedatectl`

Os valores de **time zone** (fuso horário) e de **system clock synchronized** (relógio do sistema sincronizado) mostram que o novo horário local foi atualizado com sucesso.

### <span class="ez-toc-section" id="bkmrk--7"></span>Usando o Comando tzdata (Versões Mais Antigas do Ubuntu)

Usuários de versões do Ubuntu como 16.04 ou mais baixas podem definir seus fusos horários reconfigurando os **dados de fuso horário e horário de verão** ou **tzdata**. Esses parâmetros contêm arquivos que documentam tanto as transições de fuso horário atuais quanto as histórias ao redor do planeta.

Siga estes passos para mudar o fuso horário usando o comando **tzdata**:

1. Digite o seguinte comando para reconfigurar o **tzdata** e pressione **Enter**:  
    `sudo dpkg-reconfigure tzdata`
2. A janela de configuração do pacote será aberta. Escolha sua área geográfica e pressione **Enter**.  
    ![interface do tzdata](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/The-tzdata-interface.webp)
3. Selecione **OK** e pressione **Enter**.
4. A seguir, selecione a cidade ou região que corresponde ao seu fuso horário.  
    ![lista de cidades disponíveis usando tzdata](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/List-of-available-timezones-using-tzdata-1.webp)
5. Selecione **OK** e pressione **Enter**.
6. Uma resposta vai aparecer automaticamente para garantir que seu fuso horário atual foi definido com sucesso.  
    ![fuso horário padrão atualizado](https://www.hostinger.com.br/tutoriais/wp-content/uploads/sites/12/2019/07/Current-default-time-zone-updated.webp)

Você também pode encontrar as informações de fuso horário do seu sistema operacional Linux no diretório **/etc/timezone**.

## **Conclusão**

O uso correto dos fuso horários é importante para os processos de um sistema, já que ele define quando essas tarefas serão iniciadas e finalizadas. No Ubuntu, os usuários geralmente configuram o relógio do sistema durante a instalação inicial.

Contudo, o fuso horário atual é ajustável usando três métodos fáceis: a interface gráfica de usuário (GUI), o comando **timedatectl** ou o comando **tzdata**.

Se você usa o Ubuntu 18.04, Ubuntu 20.04 ou Ubuntu 22.04, nós recomendamos o método GUI ou o comando **timedatectl**. Para Ubuntu 16.04 ou mais antigos, recomendamos reconfigurar o **tzdata**.

Esperamos que este artigo tenha ajudado você a configurar o fuso horário do seu sistema Ubuntu. Se você tiver quaisquer dúvidas ou sugestões, deixe-as na seção de comentários abaixo.

# 10 Comandos Linux que talvez nunca ouviu falar

<div id="bkmrk-" style="text-align: justify;"><div><div class="speechify-ignore ac cp"><div class="speechify-ignore bh m"><div class="ac cp hr hs ht hu hv hw hx hy hz ia ib ic id ie if ig"><div class="i l x ea eb r"><div class="iw m"><div class="ac r ix iy"><div class="pw-multi-vote-count m jn jo jp jq jr js jt"><div></div></div></div></div><div><div aria-describedby="3" aria-hidden="false" aria-labelledby="3" class="bm" role="tooltip"><div class="be" tabindex="-1"><button aria-label="responses" class="ap jd jw jx ac r ef jy jz"><svg class="jv" height="24" viewbox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M18.006 16.803c1.533-1.456 2.234-3.325 2.234-5.321C20.24 7.357 16.709 4 12.191 4S4 7.357 4 11.482c0 4.126 3.674 7.482 8.191 7.482.817 0 1.622-.111 2.393-.327.231.2.48.391.744.559 1.06.693 2.203 1.044 3.399 1.044.224-.008.4-.112.486-.287a.49.49 0 0 0-.042-.518c-.495-.67-.845-1.364-1.04-2.057a4 4 0 0 1-.125-.598zm-3.122 1.055-.067-.223-.315.096a8 8 0 0 1-2.311.338c-4.023 0-7.292-2.955-7.292-6.587 0-3.633 3.269-6.588 7.292-6.588 4.014 0 7.112 2.958 7.112 6.593 0 1.794-.608 3.469-2.027 4.72l-.195.168v.255c0 .056 0 .151.016.295.025.231.081.478.154.733.154.558.398 1.117.722 1.659a5.3 5.3 0 0 1-2.165-.845c-.276-.176-.714-.383-.941-.59z"></path></svg></button></div></div></div></div></div></div></div></div></div><div id="bkmrk--1" style="text-align: justify;"></div>Linux, a powerhouse of flexibility and control, often reveals its true magic through the command line. While `ls`, `grep`, and `cd` are universally known, the operating system houses a constellation of lesser-known utilities—each with unique capabilities. These obscure commands, once discovered, can enhance your workflows, increase productivity, and turn you into a command-line artisan.

## 1. `look` — Fast Dictionary Lookup

The `look` command performs a binary search on a sorted file, typically a dictionary, and prints all lines that begin with a given string. It's perfect for autocomplete tools, word games, or when verifying the existence of a term.

```
look pro
```

This will return all dictionary entries beginning with “pro.” Fast, lean, and astonishingly handy.

## 2. `rev` — Reverse the Characters of a Line

A surprisingly effective tool, `rev` reverses each line of input character by character. It might sound like a novelty, but it’s invaluable in scenarios involving cryptic text transformations or palindromic algorithms.

```
echo "Linux" | rev
```

This returns “xuniL”. Simple, elegant, and precise.

## 3. `tac` — The Reverse of `cat`

While `cat` displays file content from top to bottom, `tac` (cat spelled backward) prints lines in reverse order. For tail-heavy logs, or when parsing data from the bottom up, `tac` can be a lifesaver.

```
tac access.log
```

This allows you to read logs in a reverse chronological sequence without needing `tail -r`.

## 4. `yes` — Repetitive Stream Generator

The `yes` command outputs a string repeatedly until interrupted. When automating scripts or testing buffer behavior, this tool shines.

```
yes | sudo apt install mypackage
```

This command auto-confirms every prompt, useful in scripted installs.

## 5. `nl` — Number Lines of Files

A more sophisticated cousin of `cat -n`, the `nl` command adds line numbers with robust formatting control.

```
nl file.txt
```

With support for logical page delimiters and line numbering styles, `nl` is ideal for structured file documentation.

## 6. `column` — Format Output into Columns

`column` transforms textual data into well-aligned columns, making output dramatically more readable—especially when viewing CSVs or tabular data.

```
cat data.txt | column -t -s,
```

This aligns comma-separated data neatly into tabular format.

## 7. `shuf` — Shuffle Lines Randomly

Need to randomize a playlist or test against unpredictable data? `shuf` randomizes input line order effortlessly.

```
shuf list.txt
```

It’s also useful in shell-based gaming, simulation, and statistical sampling.

## 8. `comm` — Compare Two Sorted Files Line by Line

`comm` is an unsung hero in file comparison. It contrasts two sorted files line-by-line and categorizes them: lines unique to file1, file2, and lines common to both.

```
comm file1.txt file2.txt
```

Ideal for syncing datasets or identifying deltas.

## 9. `chrt` — Manipulate Real-Time Scheduling Policies

For those tinkering with performance tuning, `chrt` adjusts a process’s real-time scheduling policy. Combined with `ps` or `top`, it’s a potent performance tool.

```
sudo chrt -f 99 ./my_program
```

This elevates your process to the highest fixed-priority level.

## 10. `watch` — Execute a Program Periodically

Observe command output in near real-time with `watch`. It’s perfect for monitoring resource usage, service health, or file changes.

```
watch -n 2 df -h
```

This runs `df -h` every 2 seconds, refreshing the terminal view dynamically.

Mastering Linux means going beyond the commonplace. These ten underutilized commands unlock new layers of potential, allowing developers, admins, and enthusiasts to operate with greater fluency and finesse. With just a bit of curiosity, even the most obscure tool can become an indispensable ally in your command-line journey.

# Melhores Práticas para Downloads

Coletânea de melhores práticas

# Dica para download de diretórios de aplicativos do Bitnami

Informações extraída do CharGPT

<span style="text-decoration: underline;">**DOWNLOAD DE DIRETÓRIO DE APLICATIVOS DO BITNAMI**</span>

Para baixar o diretório `bitnami/wordpress` do repositório Bitnami Containers no GitHub, você pode utilizar os seguintes métodos:

---

##### ✅ Opção 1 – Usar o site <a class="cursor-pointer" data-end="238" data-start="170" rel="noopener" target="_new">download-directory.github.io</a>

### Passos:

1. Acesse o site: <a class="cursor-pointer" data-end="347" data-start="271" rel="noopener" target="_new">https://download-directory.github.io</a>
2. Cole o seguinte link no campo indicado:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary"><div class="sticky top-9">  
    </div><div class="overflow-y-auto p-4" dir="ltr">`https:<span class="hljs-comment">//github.com/bitnami/containers/tree/main/bitnami/wordpress</span>`</div></div>
3. Clique em **Download**.
4. O site gerará e baixará um arquivo `.zip` contendo apenas o diretório `bitnami/wordpress`.

> Este método é rápido e não requer instalação de ferramentas adicionais.

---

##### ✅ Opção 2 – Usar Git com `sparse-checkout` (linha de comando)

### Pré-requisitos:

- Git versão 2.25 ou superior instalado.

### Passos:

1. Clone o repositório com filtro para evitar baixar todo o conteúdo:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary"><div class="sticky top-9">  
    </div><div class="overflow-y-auto p-4" dir="ltr">`git <span class="hljs-built_in">clone</span> --filter=blob:none --sparse https://github.com/bitnami/containers.git`</div></div>
2. Acesse o diretório clonado:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary"><div class="sticky top-9">  
    </div><div class="overflow-y-auto p-4" dir="ltr">`<span class="hljs-built_in">cd</span> containers`</div></div>
3. Ative o modo `sparse-checkout`:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary"><div class="sticky top-9">  
    </div><div class="overflow-y-auto p-4" dir="ltr">`git sparse-checkout init --cone`</div></div>
4. Defina o diretório que deseja baixar:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary"><div class="sticky top-9">  
    </div><div class="overflow-y-auto p-4" dir="ltr">`git sparse-checkout <span class="hljs-built_in">set</span> bitnami/wordpress`</div></div>
5. Resultado: Apenas o diretório `bitnami/wordpress` será baixado para o seu sistema.

> Este método é ideal para quem deseja integrar o processo em scripts ou automações.

##### ✅ Opção 3 – Usar `npx gitzip-cli` (requer Node.js)

##### Pré-requisitos:

- Node.js instalado

### Passos:

1. Execute o seguinte comando no terminal:
    
    <div class="contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary"><div class="sticky top-9">  
    </div><div class="overflow-y-auto p-4" dir="ltr">`npx gitzip-cli https://github.com/bitnami/containers/tree/main/bitnami/wordpress`</div></div>
2. O comando irá baixar o diretório como um arquivo `.zip` na pasta atual.

> Este método é útil para quem prefere utilizar o terminal e já possui o Node.js instalado.