Ubuntu 18.04 上的默认运行级别在哪里?

Bob*_*Bob 3 18.04

有人能告诉我默认运行级别信息在 Ubuntu 18.04 上的存储位置吗(我看不到 /etc/inittab 文件了)。谢谢!

N0r*_*ert 5

在当前的 Ubuntu 版本中systemd用作初始化系统。
它使用“目标”术语来表示运行级别。

Ubuntu 有几个目标:

$ systemctl list-units --type=target --all | cat
  UNIT                   LOAD      ACTIVE   SUB    DESCRIPTION                  
? all.target             not-found inactive dead   all.target                   
  basic.target           loaded    active   active Basic System                 
  cryptsetup.target      loaded    active   active Local Encrypted Volumes      
  emergency.target       loaded    inactive dead   Emergency Mode               
  getty-pre.target       loaded    inactive dead   Login Prompts (Pre)          
  getty.target           loaded    active   active Login Prompts                
  graphical.target       loaded    active   active Graphical Interface          
  local-fs-pre.target    loaded    active   active Local File Systems (Pre)     
  local-fs.target        loaded    active   active Local File Systems           
  multi-user.target      loaded    active   active Multi-User System            
  network-online.target  loaded    active   active Network is Online            
  network-pre.target     loaded    inactive dead   Network (Pre)                
  network.target         loaded    active   active Network                      
  nss-lookup.target      loaded    active   active Host and Network Name Lookups
  nss-user-lookup.target loaded    active   active User and Group Name Lookups  
  paths.target           loaded    active   active Paths                        
  remote-fs-pre.target   loaded    inactive dead   Remote File Systems (Pre)    
  remote-fs.target       loaded    active   active Remote File Systems          
  rescue.target          loaded    inactive dead   Rescue Mode                  
  shutdown.target        loaded    inactive dead   Shutdown                     
  slices.target          loaded    active   active Slices                       
  sockets.target         loaded    active   active Sockets                      
  sound.target           loaded    active   active Sound Card                   
  swap.target            loaded    active   active Swap                         
  sysinit.target         loaded    active   active System Initialization        
? syslog.target          not-found inactive dead   syslog.target                
  time-sync.target       loaded    active   active System Time Synchronized     
  timers.target          loaded    active   active Timers                       
  umount.target          loaded    inactive dead   Unmount All Filesystems      

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

29 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
Run Code Online (Sandbox Code Playgroud)

对于桌面系统,默认值为graphical.target

$ systemctl get-default 
graphical.target
Run Code Online (Sandbox Code Playgroud)

您可以随时使用systemctl isolate命令切换目标。下面的示例将切换到基于文本的multi-user.target

sudo systemctl isolate multi-user.target
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参阅官方 Ubuntu 文档官方 RedHat 文档